Orpheus

CliRoute extends ControllerRoute
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

__toString()  : string
Get route as string
formatUrl()  : string
Format the current route to get a URL from path
getController()  : AbstractController
getControllerClass()  : string
Get the controller class
getCurrentRouteName()  : string
Get the current route name
getLink()  : string
Get the link to this route
getName()  : string
Get the name
getOptions()  : array<string|int, mixed>
Get route options
getPath()  : string
Get the path
getRootCommand()  : string
getRoute()  : CliRoute
Get the route object for the $route name
getRoutes()  : array<string|int, ControllerRoute>
Get registered routes
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()  : bool
Test current route is matching request
register()  : void
Register route by $name
registerAccessRestriction()  : void
Register the access restriction $type This will be used by isAccessible()
registerConfig()  : void
Register route by $name from config
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

Properties

$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

__toString()

Get route as string

public __toString() : string
Return values
string

formatUrl()

Format the current route to get a URL from path

public formatUrl([array<string|int, string> $values = [] ][, array<string|int, mixed> $parameters = [] ]) : string
Parameters
$values : array<string|int, string> = []
$parameters : array<string|int, mixed> = []
Return values
string

getControllerClass()

Get the controller class

public getControllerClass() : string
Return values
string

getCurrentRouteName()

Get the current route name

public static getCurrentRouteName() : string
Return values
string

Get the link to this route

public abstract getLink() : string
Return values
string

getName()

Get the name

public abstract getName() : string
Return values
string

getOptions()

Get route options

public getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPath()

Get the path

public getPath() : string
Return values
string

getRootCommand()

public static getRootCommand() : string
Return values
string

getRoute()

Get the route object for the $route name

public static getRoute(string $name) : CliRoute
Parameters
$name : string
Return values
CliRoute

initialize()

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

public static initialize() : void

isAccessible()

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 abstract isAccessible() : bool
Return values
bool

isInitialized()

Test if the class is initialized

public static isInitialized() : bool
Return values
bool

isMatchingRequest()

Test current route is matching request

public isMatchingRequest(CliRequest $request[, array<string|int, mixed> &$values = [] ][, bool $alternative = false ]) : bool
Parameters
$request : CliRequest
$values : array<string|int, mixed> = []
$alternative : bool = false
Tags
see
ControllerRoute::isMatchingRequest
Return values
bool

register()

Register route by $name

public static register(string $name, string $path, string $controller, array<string|int, mixed> $parameters[, array<string|int, mixed> $options = [] ]) : void
Parameters
$name : string
$path : string
$controller : string
$parameters : array<string|int, mixed>
$options : 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
uses
isAccessible()

registerConfig()

Register route by $name from config

public static registerConfig(string $name, array<string|int, mixed> $config) : void
Parameters
$name : string
$config : array<string|int, mixed>
Tags
throws
Exception

__construct()

Constructor

protected __construct(string $name, string $path, string $controller, array<string|int, string> $parameters, array<string|int, mixed> $options) : mixed
Parameters
$name : string
$path : string
$controller : string
$parameters : array<string|int, 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

							
On this page

Search results