Highway to PSR2
[openemr.git] / portal / patient / fwk / libs / verysimple / IO / FolderHelper.php
blob894168b35cd8043f3df26b0392977ba171ed2d07
1 <?php
2 /** @package verysimple::IO */
4 /**
5 * import supporting libraries
6 */
7 require_once("FileHelper.php");
9 /**
10 * Provided object oriented access to a file system directory
12 * @package verysimple::IO
13 * @author Jason Hinkle
14 * @copyright 1997-2007 VerySimple, Inc.
15 * @license http://www.gnu.org/licenses/lgpl.html LGPL
16 * @version 1.0
18 class FolderHelper
20 private $Path;
22 /**
23 * Constructor
25 * @access public
26 * @param string $path
27 * uri to directory to manipulate
29 function __construct($path)
31 $this->Path = $path;
34 /**
35 * Returns an array of FileHelper objects
37 * @access public
38 * @param string $pattern
39 * (not yet implemented)
40 * @return array
42 public function GetFiles($pattern = "")
44 $files = array ();
45 $dh = opendir($this->Path);
47 while ($fname = readdir($dh)) {
48 if (is_file($this->Path . $fname)) {
49 if ($pattern == "" || preg_match($pattern, $fname) > 0) {
50 $files [] = new FileHelper($this->Path . $fname);
55 closedir($dh);
57 return $files;