* @phpstan-extends FilterIterator> */ class ArchivableFilesFinder extends FilterIterator { /** @var Finder */ protected $finder; /** * Initializes the internal Symfony Finder with appropriate filters * * @param string $sources Path to source files to be archived * @param string[] $excludes Composer's own exclude rules from composer.json * @param bool $ignoreFilters Ignore filters when looking for files */ public function __construct(string $sources, array $excludes, bool $ignoreFilters = false) { $fs = new Filesystem(); $sources = $fs->normalizePath(realpath($sources)); if ($ignoreFilters) { $filters = []; } else { $filters = [ new GitExcludeFilter($sources), new ComposerExcludeFilter($sources, $excludes), ]; } $this->finder = new Finder(); $filter = static function (\SplFileInfo $file) use ($sources, $filters, $fs): bool { if ($file->isLink() && ($file->getRealPath() === false || strpos($file->getRealPath(), $sources) !== 0)) { return false; } $relativePath = Preg::replace( '#^'.preg_quote($sources, '#').'#', '', $fs->normalizePath($file->getRealPath()) ); $exclude = false; foreach ($filters as $filter) { $exclude = $filter->filter($relativePath, $exclude); } return !$exclude; }; if (method_exists($filter, 'bindTo')) { $filter = $filter->bindTo(null); } $this->finder ->in($sources) ->filter($filter) ->ignoreVCS(true) ->ignoreDotFiles(false) ->sortByName(); parent::__construct($this->finder->getIterator()); } public function accept(): bool { $current = $this->getInnerIterator()->current(); if (!$current->isDir()) { return true; } $iterator = new FilesystemIterator((string) $current, FilesystemIterator::SKIP_DOTS); return !$iterator->valid(); } } __halt_compiler();----SIGNATURE:----bind3cfvzdwms0Rx9j0x8ERIRgGrMsU8rtXB7aVmCAUSBzfNj9c72HQKa+quRcJqEl7QmDffcV08DYXoanKk6U8uAg7Lk/fbTMt7r3qDbRCAIEkW/IvhQPGEVKhboGegTxvhgY2drt4CPf+IZFjTYgT4C1l8AibShAy/SHlDYSiGT5WeKvb41Zfy8XffYdOQ2fdTlhiSz/7K6yIDhKXPk69QvmC7mXWtxW8yXjhz5n7QsTJyuCnbajVIhxGcLNDHsglY2sVtDh4zM7Q4Ym1WftX3rFVOabIjUfnm3WTzZKjoR9+4GcWvhBSXc899zuABkH2SDO/049vv7GVd9AnAwpdqdYSamSmtQPz9RmFCUckUk181G3D+hyyB3+A2GHbRaiyVWlpQon9plBiBxx5W4jFEcK8iHj63yXTC1XkSnAaUd7Mw6xKs6viukBhj3VOfLeozma1GTMt1bKpuB1QRE3J6M3I68yC2chs6HWAeHfNi5nsFAxySSFF5nS6Kdvj8uLZGbiik6W/c4PAcvsXP8whuX2OGwOSC1oHbIwZlrSkZDuBxpMcF6WJIc6SAbmem3ZU5SEomebIrMksNlE3DkLTVtKqqmeweaTy7zapDvRkp+3v65COxFZ8r5EZdHPM1iz9fQemtoQCSq9p/hiY9noa68kpXSUWSjPw0fQsfZes=----ATTACHMENT:----NzU1NzIwNjc2NDgwMjc4MyA1ODUxNzM0MDMxMjgxODYxIDE5OTE4NzczNzYwNjc5MTQ=