/** * Constructs a new FileIterator for a specified path (folder). * * The default behaviour is set. The iterator will return objects and no filter (neither RegExp * nor extension) will be applied. * * @param string Path to a folder */ public function __construct($path) { $this->extension = null; parent::__construct($path); }
/** * Returns an FileFolderIterator for the files and folders in this directory (not recursive). * * The returned iterator will return objects of the types File and Folder, but if the second * parameter is set to FileSystem::RETURN_PATHS just the paths are returned. * * The first parameter is a regular expression pattern that is used to filter the result. This * method does not allow the extension pattern that is allowed by Folder::getFileIterator(). * * @param int Whether to return objects or paths * @param string Search pattern (Regular Expression) * @return FileFolderIterator * @see Folder::getFileIterator() * @see Folder::getContents() */ public function getFileFolderIterator($pattern = null, $mode = FileSystem::RETURN_OBJECTS) { $iterator = new FileFolderIterator($this->path); if ($pattern !== null) { $iterator->setFilter($pattern); } $iterator->setMode($mode); return $iterator; }