AnnotatedRouteControllerLoader
class AnnotatedRouteControllerLoader extends AnnotationClassLoader
AnnotatedRouteControllerLoader — это реализация AnnotationClassLoader, которая устанавливает значение по умолчанию '_controller' на основе имён класса и метода.
Свойства
| protected | $reader | из AnnotationClassLoader | |
| protected string | $routeAnnotationClass | из AnnotationClassLoader | |
| protected int | $defaultRouteIndex | из AnnotationClassLoader |
Методы
| __construct(Reader $reader) | из AnnotationClassLoader | |
| setRouteAnnotationClass(string $class) Устанавливает класс аннотаций для чтения свойств маршрута. | из AnnotationClassLoader | |
| load(string $class, string|null $type = null) Загружает аннотации из класса. | из AnnotationClassLoader | |
| addRoute(RouteCollection $collection, $annot, $globals, ReflectionClass $class, ReflectionMethod $method) | из AnnotationClassLoader | |
| bool | supports(mixed $resource, string|null $type = null) Возвращает, поддерживает ли данный класс заданный ресурс. | из AnnotationClassLoader |
| setResolver(LoaderResolverInterface $resolver) Устанавливает решатель загрузчиков. | из AnnotationClassLoader | |
| LoaderResolverInterface | getResolver() Получает решатель загрузчиков. | из AnnotationClassLoader |
| string | getDefaultRouteName(ReflectionClass $class, ReflectionMethod $method) Делает имя маршрута по умолчанию более осмысленным, удаляя общие ключевые слова. | |
| getGlobals(ReflectionClass $class) | из AnnotationClassLoader | |
| createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) | из AnnotationClassLoader | |
| configureRoute(Route $route, ReflectionClass $class, ReflectionMethod $method, $annot) Настраивает параметр _controller по умолчанию для данного экземпляра Route. |
Подробное описание
__construct(Reader $reader)
Параметры
| Reader | $reader |
setRouteAnnotationClass(string $class)
Устанавливает класс аннотаций для чтения свойств маршрутов.
Параметры
| string | $class | Полное имя класса |
load(string $class, string|null $type = null)
Загружает аннотации из класса.
Параметры
| string | $class | Имя класса |
| string|null | $type | Тип ресурса или null, если неизвестен |
Исключения
| InvalidArgumentException | При невозможности парсинга маршрута |
protected addRoute(RouteCollection $collection, $annot, $globals, ReflectionClass $class, ReflectionMethod $method)
Параметры
| RouteCollection | $collection | |
| $annot | ||
| $globals | ||
| ReflectionClass | $class | |
| ReflectionMethod | $method |
bool supports(mixed $resource, string|null $type = null)
Возвращает, поддерживает ли этот класс данный ресурс.
Параметры
| mixed | $resource | Ресурс |
| string|null | $type | Тип ресурса или null, если неизвестен |
Значение результата
| bool | True, если класс поддерживает данный ресурс, иначе false |
setResolver(LoaderResolverInterface $resolver)
Устанавливает разрешитель загрузчиков.
Параметры
| LoaderResolverInterface | $resolver |
LoaderResolverInterface getResolver()
Возвращает разрешитель загрузчиков.
Значение результата
| LoaderResolverInterface | Экземпляр LoaderResolverInterface |
protected string getDefaultRouteName(ReflectionClass $class, ReflectionMethod $method)
Делает имя маршрута более осмысленным, удаляя общие ключевые слова.
Параметры
| ReflectionClass | $class | |
| ReflectionMethod | $method |
Значение результата
| string |
protected getGlobals(ReflectionClass $class)
Параметры
| ReflectionClass | $class |
protected createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition)
Параметры
| $path | ||
| $defaults | ||
| $requirements | ||
| $options | ||
| $host | ||
| $schemes | ||
| $methods | ||
| $condition |
protected configureRoute(Route $route, ReflectionClass $class, ReflectionMethod $method, $annot)
Настраивает параметр _controller по умолчанию для данного экземпляра Route.
Параметры
| Route | $route | |
| ReflectionClass | $class | |
| ReflectionMethod | $method | |
| $annot |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Bundle/FrameworkBundle/Routing/AnnotatedRouteControllerLoader.html