AnnotatedRouteControllerLoader
class AnnotatedRouteControllerLoader extends AnnotationClassLoader
AnnotatedRouteControllerLoader is an implementation of AnnotationClassLoader that sets the '_controller' default based on the class and method names.
Properties
protected | $reader | from AnnotationClassLoader | |
protected string | $routeAnnotationClass | from AnnotationClassLoader | |
protected int | $defaultRouteIndex | from AnnotationClassLoader |
Methods
__construct(Reader $reader) | from AnnotationClassLoader | |
setRouteAnnotationClass(string $class) Sets the annotation class to read route properties from. | from AnnotationClassLoader | |
load(string $class, string|null $type = null) Loads from annotations from a class. | from AnnotationClassLoader | |
addRoute(RouteCollection $collection, $annot, $globals, ReflectionClass $class, ReflectionMethod $method) | from AnnotationClassLoader | |
bool | supports(mixed $resource, string|null $type = null) Returns whether this class supports the given resource. | from AnnotationClassLoader |
setResolver(LoaderResolverInterface $resolver) Sets the loader resolver. | from AnnotationClassLoader | |
LoaderResolverInterface | getResolver() Gets the loader resolver. | from AnnotationClassLoader |
string | getDefaultRouteName(ReflectionClass $class, ReflectionMethod $method) Makes the default route name more sane by removing common keywords. | |
getGlobals(ReflectionClass $class) | from AnnotationClassLoader | |
createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) | from AnnotationClassLoader | |
configureRoute(Route $route, ReflectionClass $class, ReflectionMethod $method, $annot) Configures the _controller default parameter of a given Route instance. |
Details
__construct(Reader $reader)
Parameters
Reader | $reader |
setRouteAnnotationClass(string $class)
Sets the annotation class to read route properties from.
Parameters
string | $class | A fully-qualified class name |
load(string $class, string|null $type = null)
Loads from annotations from a class.
Parameters
string | $class | A class name |
string|null | $type | The resource type or null if unknown |
Exceptions
InvalidArgumentException | When route can't be parsed |
protected addRoute(RouteCollection $collection, $annot, $globals, ReflectionClass $class, ReflectionMethod $method)
Parameters
RouteCollection | $collection | |
$annot | ||
$globals | ||
ReflectionClass | $class | |
ReflectionMethod | $method |
bool supports(mixed $resource, string|null $type = null)
Returns whether this class supports the given resource.
Parameters
mixed | $resource | A resource |
string|null | $type | The resource type or null if unknown |
Return Value
bool | True if this class supports the given resource, false otherwise |
setResolver(LoaderResolverInterface $resolver)
Sets the loader resolver.
Parameters
LoaderResolverInterface | $resolver |
LoaderResolverInterface getResolver()
Gets the loader resolver.
Return Value
LoaderResolverInterface | A LoaderResolverInterface instance |
protected string getDefaultRouteName(ReflectionClass $class, ReflectionMethod $method)
Makes the default route name more sane by removing common keywords.
Parameters
ReflectionClass | $class | |
ReflectionMethod | $method |
Return Value
string |
protected getGlobals(ReflectionClass $class)
Parameters
ReflectionClass | $class |
protected createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition)
Parameters
$path | ||
$defaults | ||
$requirements | ||
$options | ||
$host | ||
$schemes | ||
$methods | ||
$condition |
protected configureRoute(Route $route, ReflectionClass $class, ReflectionMethod $method, $annot)
Configures the _controller default parameter of a given Route instance.
Parameters
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