/** * Get instance of DirectoryScanner with filter options applied * * @param bool $filter * @return DirectoryScanner */ public function getScanner($filter = TRUE) { $scanner = new DirectoryScanner(); if ($filter) { $scanner->setIncludes($this->config->getInclude()); $scanner->setExcludes($this->config->getExclude()); } if ($this->config->isFollowSymlinks()) { $scanner->setFlag(\FilesystemIterator::FOLLOW_SYMLINKS); } return $scanner; }
/** * Set an exclude match on *.txt * */ public function testSetExcludes() { $test = array('*.txt'); $tmp = new DirectoryScanner(); $tmp->setExcludes($test); $this->assertEquals($test, $tmp->getExcludes()); }