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)

No description

setRouteAnnotationClass(string $class)

Sets the annotation class to read route properties from.

load(string $class, string|null $type = null)

Loads from annotations from a class.

addRoute(RouteCollection $collection, $annot, $globals, ReflectionClass $class, ReflectionMethod $method)

No description

bool
supports(mixed $resource, string|null $type = null)

Returns whether this class supports the given resource.

setResolver(LoaderResolverInterface $resolver)

Sets the loader resolver.

getResolver()

Gets the loader resolver.

string
getDefaultRouteName(ReflectionClass $class, ReflectionMethod $method)

Makes the default route name more sane by removing common keywords.

getGlobals(ReflectionClass $class)

No description

createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition)

No description

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