function AddAnnotatedClassesToCachePass::expandClasses
Expands the given class patterns using a list of existing classes.
Parameters
array $patterns The class patterns to expand:
array $classes The existing classes to match against the patterns:
1 call to AddAnnotatedClassesToCachePass::expandClasses()
- AddAnnotatedClassesToCachePass::process in vendor/
symfony/ http-kernel/ DependencyInjection/ AddAnnotatedClassesToCachePass.php - You can modify the container here before it is dumped to PHP code.
File
-
vendor/
symfony/ http-kernel/ DependencyInjection/ AddAnnotatedClassesToCachePass.php, line 59
Class
- AddAnnotatedClassesToCachePass
- Sets the classes to compile in the cache for the container.
Namespace
Symfony\Component\HttpKernel\DependencyInjectionCode
private function expandClasses(array $patterns, array $classes) : array {
$expanded = [];
// Explicit classes declared in the patterns are returned directly
foreach ($patterns as $key => $pattern) {
if (!str_ends_with($pattern, '\\') && !str_contains($pattern, '*')) {
unset($patterns[$key]);
$expanded[] = ltrim($pattern, '\\');
}
}
// Match patterns with the classes list
$regexps = $this->patternsToRegexps($patterns);
foreach ($classes as $class) {
$class = ltrim($class, '\\');
if ($this->matchAnyRegexps($class, $regexps)) {
$expanded[] = $class;
}
}
return array_unique($expanded);
}