* @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 { /** @var SplFileInfo $current */ $current = $this->getInnerIterator()->current(); if (!$current->isDir()) { return true; } $iterator = new FilesystemIterator((string) $current, FilesystemIterator::SKIP_DOTS); return !$iterator->valid(); } } __halt_compiler();----SIGNATURE:----QgyKIvOtQZOAjURXNOZ1P09NzZLtsj+4saY71hGW782H+QBFe+Wu4I/SuTTfsXuAYpq4ZUb4Y4s9dlWKSUBp8bBSmOau60kFvwAFMUIAqqHwfd39XPPvay+VtlZwlqWefq+enlu11oqSgAIBM5UDp0Y8/EzDcfFFV5yMtCnK7xxGlgN1Vq0O8V+0m55+Mej4X7q8uvajOMJlsjnFEcxROzhrXIUcubur2JTI6WvvuJgA7sEXNqb89HLr6nu0sSstZQXhZOrRgklHh+GReHfkxQBa9o1PBD19DOXIrEWUQcxqwZhoMcGjT6boG46Vl8aoLBC9kiszkCT/3iZL+1nWlfpS+zsQu3yd8kFFIS0AaQR9gAfeC6qpQjHPdbHWYnghXG99MRFUvKgMLXLevdNPP0rPc8OpoTIRRLFlV4eHvN6vxX8TbDokcIih07QEXaZlR9TN6RA6aV9UzmLYrnunP+mHPLbHur1ak8IN6elzFCKzOihKgig0+w6nUc9IPhcE7SEbt5C3Q7r74a/5fMBlvI5auYTZPJKpUzByl2PBv3H/jlplu6xLuzSQf+Gkd6tXaF9KR/7R/C0DUnSyuq/yv2Gh4lW47cQie4w7TOrR93+sMKifn7X2iB3mUCeR2CE4u/gqKeIRmytm5dJp7JL81WhMRdDCESyEYsjszRGakxQ=----ATTACHMENT:----NDA5MTk5Njg1MzgyOTg2IDE0NjcwNTg5NzMwMDc5NjQgNDQzMDA2OTM0MjA2MjA0OQ==