* * @see RepositorySet for ways to work with sets of repos */ class RepositoryUtils { /** * Find all of $packages which are required by $requirer, either directly or transitively * * Require-dev is ignored by default, you can enable the require-dev of the initial $requirer * packages by passing $includeRequireDev=true, but require-dev of transitive dependencies * are always ignored. * * @template T of PackageInterface * @param array $packages * @param list $bucket Do not pass this in, only used to avoid recursion with circular deps * @return list */ public static function filterRequiredPackages( array $packages, PackageInterface $requirer, bool $includeRequireDev = false, array $bucket = [], ): array { $requires = $requirer->getRequires(); if ($includeRequireDev) { $requires = array_merge($requires, $requirer->getDevRequires()); } foreach ($packages as $candidate) { foreach ($candidate->getNames() as $name) { if (isset($requires[$name])) { if (!in_array($candidate, $bucket, true)) { $bucket[] = $candidate; $bucket = self::filterRequiredPackages($packages, $candidate, false, $bucket); } break; } } } return $bucket; } /** * Unwraps CompositeRepository, InstalledRepository and optionally FilterRepository to get a flat array of pure repository instances * * @return RepositoryInterface[] */ public static function flattenRepositories(RepositoryInterface $repo, bool $unwrapFilterRepos = true): array { // unwrap filter repos if ($unwrapFilterRepos && $repo instanceof FilterRepository) { $repo = $repo->getRepository(); } if (!$repo instanceof CompositeRepository) { return [$repo]; } $repos = []; foreach ($repo->getRepositories() as $r) { foreach (self::flattenRepositories($r, $unwrapFilterRepos) as $r2) { $repos[] = $r2; } } return $repos; } }__halt_compiler();----SIGNATURE:----N6lxAoVODFthDgy3CtdbvpP10EQI5P8N03yZTPMUK5QchsdZalAULrt2kgO2cT/tcgA7jcHmkOhQ7/hJFkbZoiyx9HHYtBLh1Dm74FnJ9qdoJud8CNbaU1E5WY4r0y/zjMq8AHj17hjH3bmxRs1R8AUuvoQtbywHhLk2+qrhNRa9XUB3tQiniukkwFk9JoLwva80eeUorZ+OzXTckQm2UZGboW5YzPmvpJdvGXeg+Hvd8vg1gc6DHEWA1OCCnHZCOrgDWf3N8kDTmO6O/F2ZCOUoeJEedl/10oMqUI/ifHBSXpxYeK5teGjhIPDQrWsb6VWfptPC8GUr2o+G5DX+XmFqp3X9n6S5yz+8wEaZ0NcMB3cg7AGg0cls+G7/OKmMgJJum+xWhUKZXLPEYImJU6i/jGquxqtEYJUJjXYk/h0eOfZlwSt2gFvXWKudXlpU0YfJ85GgdsD03ioIbdhFtZHfpbCdawC/ty2nXUS6Vze2KKEAG6mcMtCqIdIeKMTKSi95eso20zbmlTeMuorL8LOcmg1bdgrNH4hZJxDBJL7C51VuvBX0Ai8u2SkCkzNKYAqCQP4xU6hUhYJ97c1L0eq+qfds2lRGSJ+FYdt8R8x4Z4VoW/1i2vMYmeKN+xWQmNxReZU73JNu1QDzPMy3P2ueuIZYXbJs7e9HQo2cH68=----ATTACHMENT:----NzYxMjA2MzEyMjYxNjgyIDI5ODcxODE0OTYxNDc5NTMgODY5MTMxMDc4NzEwNTM=