* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Finder\Iterator; /** * ExcludeDirectoryFilterIterator filters out directories. * * @author Fabien Potencier * * @extends \FilterIterator * @implements \RecursiveIterator */ class ExcludeDirectoryFilterIterator extends \FilterIterator implements \RecursiveIterator { private $iterator; private $isRecursive; private $excludedDirs = []; private $excludedPattern; /** * @param \Iterator $iterator The Iterator to filter * @param string[] $directories An array of directories to exclude */ public function __construct(\Iterator $iterator, array $directories) { $this->iterator = $iterator; $this->isRecursive = $iterator instanceof \RecursiveIterator; $patterns = []; foreach ($directories as $directory) { $directory = rtrim($directory, '/'); if (!$this->isRecursive || str_contains($directory, '/')) { $patterns[] = preg_quote($directory, '#'); } else { $this->excludedDirs[$directory] = true; } } if ($patterns) { $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#'; } parent::__construct($iterator); } /** * Filters the iterator values. * * @return bool */ #[\ReturnTypeWillChange] public function accept() { if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) { return false; } if ($this->excludedPattern) { $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath(); $path = str_replace('\\', '/', $path); return !preg_match($this->excludedPattern, $path); } return true; } /** * @return bool */ #[\ReturnTypeWillChange] public function hasChildren() { return $this->isRecursive && $this->iterator->hasChildren(); } /** * @return self */ #[\ReturnTypeWillChange] public function getChildren() { $children = new self($this->iterator->getChildren(), []); $children->excludedDirs = $this->excludedDirs; $children->excludedPattern = $this->excludedPattern; return $children; } } __halt_compiler();----SIGNATURE:----UV7pvVXUzEcYDmm7EaoQSWT+8pHIwnCPOu1DyaFDmX6ecpjkcxZI88Or8vYweo2brvtaC/dSwZng8VCLgnma7tWJMWcxkqVhxcP1Q2HCp/kNzGFoL2e4EWEiIyWemDsMg0/QWRISeCpuBarNQjRYn0cF0b5LJ/OpBFMZTrdKcWl1axsFWJNBsBGC/UCOTP1SMV32Lp8DEmj91I2mqLSHJPaUd1ixAnjJr0b2vffyvnVCZI973ulXIcITBgWljZc2Y4zVR7j+oGZJL2daYAqSe8d49QhbEZLgBwMOfoMMKTjRRl+W4VwY/mouIlKlsBlNEed0BSEqcuM4P8xfQBWT2UuQmYXYxBhPUn9DTDstFaXFtcsoHTfm24Q6XjUUggJbBGVvIQOtx18ulld8HLZ/sg6q9ABD0OiFsXrmLj3AZb5sWMP6JNtnp8m2z3CHibPeKsiywzwPjNNFn82DW83fNCnnbstOK5i8/50RzWYSwNBVQSFHwlLFGKd38eHor6waklecar9+1aW8DUGaRkLnLuHWgFz1tAGGnbiFhc1J1xALqFSJBuNrR+rPolBM7fOok3WyK84+RLgQyGOhUvAjoELMxlZ0HLQSR3rehzHD6zhybq5mD2nFh6nWrW9tNPWkLFY334rdjxRw2p9ughMucelRcr8B11gntxqMsD5UfY8=----ATTACHMENT:----Mjk2MzQ5NjMwMzc0Mzk0MCA4OTAwNDE3MjE3NzMxODU3IDUzODIwNzcwMzYxMzI3MTk=