ControllerRoute
extends Route
in package
Route for Orpheus.
Table of Contents
Constants
- PROVIDERS_KEY = 'providers'
- REQUIREMENTS_KEY = 'require-packages'
Properties
- $controller : AbstractController
- The running controller
- $controllerClass : string
- The class of called controller associated to this route
- $defaultResponse : string
- Default response if controller returns is invalid
- $initialized : bool
- Define this class initialized
- $name : string
- A route is identified by its name
- $options : array<string|int, mixed>
- Non-processed options in route configuration
- $path : string
- The path determine how to access this route
- $restrictTo : array<string|int, mixed>
- Restrictions to access this route
- $routes : array<string|int, mixed>
- Registered routes
- $routesRestrictions : array<string|int, mixed>
- Registered route restrictions
Methods
- formatUrl() : string
- Format the URL to this route using $values
- getController() : AbstractController
- getControllerClass() : string
- Get the controller class
- getCurrentRouteName() : string
- Get the current route name
- getLink() : string
- Get link of route
- getName() : string
- Get the name
- getOptions() : array<string|int, mixed>
- Get route options
- getPath() : string
- Get the path
- getRoutes() : array<string|int, ControllerRoute>
- Get all registered routes These one are commonly stored in the configuration (routes.yaml)
- initialize() : void
- Initialize the route class by loading the configuration (once only)
- instantiateController() : AbstractController
- Instantiate the controller and return it
- isAccessible() : bool
- Test if the route is accessible in the current context using restrictTo This method is sensitive to CHECK_MODULE_ACCESS constant, a true value make it always accessible, never use it in production
- isInitialized() : bool
- Test if the class is initialized
- isMatchingRequest() : mixed
- Test if the route matches the given $request
- registerAccessRestriction() : void
- Register the access restriction $type This will be used by isAccessible()
- registerConfig() : mixed
- Register a route configuration
- run() : OutputResponse
- Run the $request by processing the matching controller
- __construct() : mixed
- Constructor
- loadRoutes() : void
- Load routes from $package or app (if null)
- mergeRoutes() : void
- Merge routes array with routes' logic
- populateRoutesFromFile() : void
- Populate given array with routes from $file in $package (or app if null)
Constants
PROVIDERS_KEY
public
mixed
PROVIDERS_KEY
= 'providers'
REQUIREMENTS_KEY
public
mixed
REQUIREMENTS_KEY
= 'require-packages'
Properties
$controller
The running controller
protected
AbstractController
$controller
$controllerClass
The class of called controller associated to this route
protected
string
$controllerClass
The controller class
$defaultResponse
Default response if controller returns is invalid
protected
string
$defaultResponse
$initialized
Define this class initialized
protected
static bool
$initialized
= false
$name
A route is identified by its name
protected
string
$name
The name
$options
Non-processed options in route configuration
protected
array<string|int, mixed>
$options
$path
The path determine how to access this route
protected
string
$path
The path
$restrictTo
Restrictions to access this route
protected
array<string|int, mixed>
$restrictTo
$routes
Registered routes
protected
static array<string|int, mixed>
$routes
= []
$routesRestrictions
Registered route restrictions
protected
static array<string|int, mixed>
$routesRestrictions
= []
Methods
formatUrl()
Format the URL to this route using $values
public
abstract formatUrl([array<string|int, mixed> $values = [] ][, array<string|int, mixed> $parameters = [] ]) : string
Parameters
- $values : array<string|int, mixed> = []
- $parameters : array<string|int, mixed> = []
Return values
stringgetController()
public
getController() : AbstractController
Return values
AbstractControllergetControllerClass()
Get the controller class
public
getControllerClass() : string
Return values
stringgetCurrentRouteName()
Get the current route name
public
static getCurrentRouteName() : string
Return values
stringgetLink()
Get link of route
public
getLink([array<string|int, mixed> $values = [] ]) : string
Parameters
- $values : array<string|int, mixed> = []
Tags
Return values
stringgetName()
Get the name
public
getName() : string
Return values
stringgetOptions()
Get route options
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getPath()
Get the path
public
getPath() : string
Return values
stringgetRoutes()
Get all registered routes These one are commonly stored in the configuration (routes.yaml)
public
static getRoutes() : array<string|int, ControllerRoute>
Return values
array<string|int, ControllerRoute>initialize()
Initialize the route class by loading the configuration (once only)
public
static initialize() : void
instantiateController()
Instantiate the controller and return it
public
instantiateController() : AbstractController
Return values
AbstractControllerisAccessible()
Test if the route is accessible in the current context using restrictTo This method is sensitive to CHECK_MODULE_ACCESS constant, a true value make it always accessible, never use it in production
public
isAccessible() : bool
Tags
Return values
boolisInitialized()
Test if the class is initialized
public
static isInitialized() : bool
Return values
boolisMatchingRequest()
Test if the route matches the given $request
public
abstract isMatchingRequest(InputRequest $request[, array<string|int, mixed> &$values = [] ]) : mixed
Parameters
- $request : InputRequest
- $values : array<string|int, mixed> = []
registerAccessRestriction()
Register the access restriction $type This will be used by isAccessible()
public
static registerAccessRestriction(string $type, callable $callable) : void
Parameters
- $type : string
- $callable : callable
Tags
registerConfig()
Register a route configuration
public
static registerConfig(string $name, array<string|int, mixed> $config) : mixed
Parameters
- $name : string
- $config : array<string|int, mixed>
run()
Run the $request by processing the matching controller
public
run(InputRequest $request) : OutputResponse
Parameters
- $request : InputRequest
Tags
Return values
OutputResponse__construct()
Constructor
protected
__construct(string $name, string $path, string $controller, array<string|int, mixed>|null $restrictTo, string $defaultResponse, array<string|int, mixed> $options) : mixed
Parameters
- $name : string
- $path : string
- $controller : string
- $restrictTo : array<string|int, mixed>|null
- $defaultResponse : string
- $options : array<string|int, mixed>
loadRoutes()
Load routes from $package or app (if null)
protected
static loadRoutes(array<string|int, mixed> &$routes[, string|null $package = null ]) : void
Parameters
- $routes : array<string|int, mixed>
- $package : string|null = null
mergeRoutes()
Merge routes array with routes' logic
protected
static mergeRoutes(array<string|int, mixed> &$routes, array<string|int, mixed> $added) : void
Parameters
- $routes : array<string|int, mixed>
- $added : array<string|int, mixed>
populateRoutesFromFile()
Populate given array with routes from $file in $package (or app if null)
protected
static populateRoutesFromFile(array<string|int, mixed> &$routes, string $file[, string|null $package = null ][, bool $optional = false ]) : void
Parameters
- $routes : array<string|int, mixed>
- $file : string
- $package : string|null = null
- $optional : bool = false