ObjectLoader
extends Loader
in package
A route loader that calls a method on an object to load the routes.
Tags
Table of Contents
- $env : mixed
- $resolver : mixed
- __construct() : mixed
- getResolver() : LoaderResolverInterface
- Gets the loader resolver.
- import() : mixed
- Imports a resource.
- load() : RouteCollection
- Calls the object method that will load the routes.
- resolve() : LoaderInterface
- Finds a loader able to load an imported resource.
- setResolver() : mixed
- Sets the loader resolver.
- getObject() : object
- Returns the object that the method will be called on to load routes.
- addClassResource() : mixed
Properties
$env
protected
mixed
$env
$resolver
protected
mixed
$resolver
Methods
__construct()
public
__construct([string|null $env = null ]) : mixed
Parameters
- $env : string|null = null
Return values
mixed —getResolver()
Gets the loader resolver.
public
getResolver() : LoaderResolverInterface
Return values
LoaderResolverInterface —import()
Imports a resource.
public
import(mixed $resource[, string|null $type = null ]) : mixed
Parameters
- $resource : mixed
-
A resource
- $type : string|null = null
-
The resource type or null if unknown
Return values
mixed —load()
Calls the object method that will load the routes.
public
load(string $resource[, string|null $type = null ]) : RouteCollection
Parameters
- $resource : string
-
object_id::method
- $type : string|null = null
-
The resource type
Return values
RouteCollection —resolve()
Finds a loader able to load an imported resource.
public
resolve(mixed $resource[, string|null $type = null ]) : LoaderInterface
Parameters
- $resource : mixed
-
A resource
- $type : string|null = null
-
The resource type or null if unknown
Tags
Return values
LoaderInterface —setResolver()
Sets the loader resolver.
public
setResolver(LoaderResolverInterface $resolver) : mixed
Parameters
- $resolver : LoaderResolverInterface
Return values
mixed —getObject()
Returns the object that the method will be called on to load routes.
protected
abstract getObject(string $id) : object
For example, if your application uses a service container, the $id may be a service id.
Parameters
- $id : string
Return values
object —addClassResource()
private
addClassResource(ReflectionClass $class, RouteCollection $collection) : mixed
Parameters
- $class : ReflectionClass
- $collection : RouteCollection