function AddAnnotatedClassesToCachePass::patternsToRegexps
1 call to AddAnnotatedClassesToCachePass::patternsToRegexps()
- AddAnnotatedClassesToCachePass::expandClasses in vendor/
symfony/ http-kernel/ DependencyInjection/ AddAnnotatedClassesToCachePass.php - Expands the given class patterns using a list of existing classes.
File
-
vendor/
symfony/ http-kernel/ DependencyInjection/ AddAnnotatedClassesToCachePass.php, line 106
Class
- AddAnnotatedClassesToCachePass
- Sets the classes to compile in the cache for the container.
Namespace
Symfony\Component\HttpKernel\DependencyInjectionCode
private function patternsToRegexps(array $patterns) : array {
$regexps = [];
foreach ($patterns as $pattern) {
// Escape user input
$regex = preg_quote(ltrim($pattern, '\\'));
// Wildcards * and **
$regex = strtr($regex, [
'\\*\\*' => '.*?',
'\\*' => '[^\\\\]*?',
]);
// If this class does not end by a slash, anchor the end
if (!str_ends_with($regex, '\\')) {
$regex .= '$';
}
$regexps[] = '{^\\\\' . $regex . '}';
}
return $regexps;
}