Route
in package
Instantiation of a RouteDef, based on a given path.
The root route is the parent of all routes in the context of any request. It sets shared roles, but cannot be associated with a controller. As the path of any request starts with '/' (even '' as it is equivalent to '/'), and as a path segment is defined as each URL-decoded segment of the absolute path split by (before being decoded) forward slash, then the first path segment of any request is '', which matches the root route. The home route is the root route's child (assuming it is a parent route) with the key '', assuming it is defined.
Unlike RouteDef-s, a Route only knows about its direct parent, and not about its child routes.
Table of Contents
Properties
Methods
- __construct() : mixed
- getFqcn() : null|IRoutedController>
- The FQCN of the controller associated with this route.
- getParamOrNull() : string|null
- getPath() : string
- Compute the absolute path from the root route up to this route.
- getRoles() : array<int, string>
Properties
$def
public
RouteDef
$def
$params
public
array<string|int, mixed>
$params
= []
$parent
public
Route|null
$parent
$seg
public
string
$seg
Methods
__construct()
public
__construct(RouteDef $def, string $seg, Route|null $parent[, array<int, string> $params = [] ]) : mixed
Parameters
- $def : RouteDef
-
The associated route definition.
- $seg : string
- $parent : Route|null
- $params : array<int, string> = []
-
the associated path segments of the path that instantiated the current route. For a parameterised route, only the segments corresponding to the arguments are passed.
Tags
getFqcn()
The FQCN of the controller associated with this route.
public
getFqcn() : null|IRoutedController>
Return values
null|IRoutedController>getParamOrNull()
public
getParamOrNull(int $index) : string|null
Parameters
- $index : int
Return values
string|null —the parameter from the given array at the given index, or null if the index is beyond the array's range.
getPath()
Compute the absolute path from the root route up to this route.
public
getPath() : string
This will always have a leading slash.
Tags
Return values
stringgetRoles()
public
getRoles() : array<int, string>