Properties

$resolverClass

$resolverClass : string

Class of the resolver

Type

string

$name

$name : string

A route is identified by its name

Type

string — The name

$path

$path : string

The path determine how to access this route

Type

string — The path

$controllerClass

$controllerClass : string

The class of called controller associated to this route

Type

string — The controller class

$options

$options : array

Non-processed options in route configuration

Type

array

$restrictTo

$restrictTo : array

Restrictions to access this route

Type

array

$routes

$routes : array

Registered routes

Type

array

$routesRestrictions

$routesRestrictions : array

Registered route restrictions

Type

array

$initialized

$initialized : string

Define this class initialized

Type

string

Methods

isAccessible()

isAccessible() : boolean

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

Returns

boolean

getLink()

getLink() : boolean

Get the link to this route

Returns

boolean

getName()

getName() : string

Get the name

Returns

string

suggestResolver()

suggestResolver(string  $class) 

Suggest resolve $class

Parameters

string $class

setResolver()

setResolver(string  $class) 

Set the resolver class

Parameters

string $class

getRoute()

getRoute(string  $name) : \Orpheus\Core\Route

Get Route object for this name

Parameters

string $name

Throws

\Exception

Returns

\Orpheus\Core\Route

getCurrentRouteName()

getCurrentRouteName() : string

Get the current route name

Returns

string

isMatchingRequest()

isMatchingRequest(\Orpheus\InputController\InputRequest  $request, array  $values = array(), boolean  $alternative = false) 

Test if the route matches the given $request

Parameters

\Orpheus\InputController\InputRequest $request
array $values
boolean $alternative

True if we are looking for an alternative route, because we did not find any primary one

getRoutes()

getRoutes() : array<mixed,\Orpheus\InputController\ControllerRoute>

Get all registered routes Routes are commonly stored in the configuration

Returns

array<mixed,\Orpheus\InputController\ControllerRoute>

registerConfig()

registerConfig(string  $name, array  $config) 

Register a route configuration

Parameters

string $name
array $config

Throws

\Exception

initialize()

initialize() 

Initialize the route class by loading the configuration (once only)

isInitialized()

isInitialized() : boolean

Test if the class is initialized

Returns

boolean

getPath()

getPath() : string

Get the path

Returns

string

getControllerClass()

getControllerClass() : string

Get the controller class

Returns

string

getOptions()

getOptions() : array

Get route options

Returns

array

formatURL()

formatURL(array  $values = array()) 

Format the URL to this route using $values

Parameters

array $values

registerAccessRestriction()

registerAccessRestriction(string  $type, callable  $callable) 

Register the access restriction $type This will be used by isAccessible()

Parameters

string $type
callable $callable

__construct()

__construct(string  $name, string  $path, string  $controller, array  $restrictTo, string  $defaultResponse, array  $options) 

Constructor

Parameters

string $name
string $path
string $controller
array $restrictTo
string $defaultResponse
array $options