示例#1
0
 public function __construct($path)
 {
     $realPath = FileSystem::getRealPath($path);
     if (FileSystem::exists($realPath) && FileSystem::isFile($realPath)) {
         $this->path = $realPath;
     }
 }
示例#2
0
 public function getFiles()
 {
     $return = [];
     $exclude = array('..', '.', '.DS_Store', '.git', '.gitignore', '.idea');
     $array = array_diff(scandir($this->path), $exclude);
     foreach ($array as $item) {
         $path = $this->path . DIRECTORY_SEPARATOR . $item;
         if (FileSystem::isDirectory($path)) {
             $return[] = new Directory($path);
         } else {
             if (FileSystem::isImage($path)) {
                 $return[] = new Image($path);
             } else {
                 if (FileSystem::isFile($path)) {
                     $return[] = new File($path);
                 }
             }
         }
     }
     return $return;
 }