Пример #1
0
 /**
  * @param Directory $directory
  * @return FileManager
  */
 public function getFilesFromDirectory(Directory $directory)
 {
     $this->removeAll();
     if ($directory->isDir()) {
         foreach (scandir($directory->getPath()) as $file) {
             if (substr($file, 0, 1) != ".") {
                 $File = new File(rtrim($directory->getPath(), "/") . "/" . $file);
                 if ($File->isFile()) {
                     $this->add($File);
                 }
             }
         }
     }
     return $this;
 }
Пример #2
0
 /**
  * @param Directory $directory
  * @return DirectoryManager
  */
 public function getDirectoryFromDirectory(Directory $directory)
 {
     $this->removeAll();
     if ($directory->isDir()) {
         foreach (scandir($directory->getPath()) as $dir) {
             if (substr($dir, 0, 1) != ".") {
                 $Directory = new Directory(rtrim($directory->getPath(), "/") . "/" . $dir);
                 if ($Directory->isDir()) {
                     $this->add($Directory);
                 }
             }
         }
     }
     return $this;
 }