RouteDef
in package
Associates a page configuration or null to a consecutive set of HTTP path segments.
It was necessary to introduce the dual concept of a route and of a route definition. This is because some parts of the application are only concerned with defining an exclusive set of URL paths (a route definition) in order to provide informations about them, including how to respond to them. Meanwhile, the actual route matches only specific path (a route) and is instantiated at runtime necessarily.
Unlike Route-s, a RouteDef only knows about its direct descendants not about its parent.
Tags
Table of Contents
Properties
- $children : array<string|int, mixed>
- $noParamConf : null|IPageConf
- $params : array<string|int, mixed>
- $roles : array<string|int, mixed>
Methods
- __construct() : mixed
- getNParamsMax() : int<0, max>
Properties
$children
public
array<string|int, mixed>
$children
= []
$noParamConf
public
null|IPageConf
$noParamConf
= null
$params
public
array<string|int, mixed>
$params
= []
$roles
public
array<string|int, mixed>
$roles
= []
Methods
__construct()
public
__construct([null|IPageConf $noParamConf = null ][, array<int, null|IPageConf> $params = [] ][, array<string, self> $children = [] ][, array<int, string> $roles = [] ]) : mixed
Parameters
- $noParamConf : null|IPageConf = null
-
The route configuration for routes of this definition that did not receive any parameters. It's not merged with $params for multiple reasons: makes counting actual parameters easier (though the first segment could be considered a paraeter in its own right), prevents empty $params which would be meaningless (a route definition has to match at least one path on at least one segment), makes it easier to impose a type on the first route configuration. Defining a configuration for each number of parameters, including 0, also allows us to remove the NotEnoughParams exception and the code to check it is thrown.
- $params : array<int, null|IPageConf> = []
-
Route configuration for each index of the last received route parameter.
- $children : array<string, self> = []
-
The child routes as an array of route definitions, indexed by the path segment through which they are accessed.
- $roles : array<int, string> = []
-
Roles for this route definition and its descendants if not overwritten.
getNParamsMax()
public
getNParamsMax() : int<0, max>