/** * @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; }
/** * @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; }