Example #1
0
 public function __construct(File $filename)
 {
     if (file_exists($filename->toString())) {
         $this->pointer = fopen($filename->toString(), 'r');
     } else {
         throw new Exception($filename->toString() . ' does not exist!');
     }
 }
 /**
  * returns the contents of a directory in an array
  */
 public function lister(File $f, $filter = null)
 {
     $dir = @opendir($f->getAbsolutePath()->toNative());
     if (!$dir) {
         throw new Exception("Can't open directory " . $f->toString());
     }
     $vv = array();
     while (($file = @readdir($dir)) !== false) {
         if ($file == "." || $file == "..") {
             continue;
         }
         $vv[] = (string) $file;
     }
     @closedir($dir);
     return $vv;
 }