/** * Create a new command instance. * @param string $folder * @param string $fileType * @param int $depth * @throws FileException */ public function __construct($folder, $fileType = '*jpg', $depth = 0) { $this->folder = $folder; $this->fileType = $fileType; /** @var \Symfony\Component\Finder\Finder $directoriesFound */ $filesFound = $this->findFiles($this->folder, $this->fileType, $depth); if ($filesFound) { try { /** @var \Symfony\Component\Finder\SplFileInfo $file */ foreach ($filesFound as $file) { array_push($this->results, $file); } } catch (\Exception $e) { echo 'not accessible' . PHP_EOL; } } else { throw FileException::noFilesFound($this->folder); return false; } return true; }