com\setasign\SetaFramework\Router
Router Class Router
File: /SetaFramework/src/Router/Router.php
Class hierarchy
Implements
- \Psr\Log\LoggerAwareInterface
Summary
Constants
DEFAULT_PRIORITY
Properties
$defaultValues
$logger
Methods
appendRoute()
Route\RouteInterface $route,
string $after = '',
int $priority = AbstractRouter::DEFAULT_PRIORITY
Append a route after the route $after.
If $after is an empty string than the added route will be the last route.
The name of the route need to be unique.
Parameters
- $name : string
Name of the new route
- $route : Route\RouteInterface
Route
- $after : string
Append this route after the route with this name
- $priority : int
Exceptions
Throws RouteException
getRoute()
getRoutes()
prependRoute()
Route\RouteInterface $route,
string $before = '',
int $priority = AbstractRouter::DEFAULT_PRIORITY
Prepend a route before the route $before.
If $before is an empty string than the added route will be the first route.
The name of the route need to be unique.
Parameters
- $name : string
Name of the new route
- $route : Route\RouteInterface
Route
- $before : string
Prepend this route before the route with this name
- $priority : int
Exceptions
Throws RouteException
process()
Tests all routes
The returned data of the route will be merged with the Router::defaultValues array with the priority on the values from the route
Parameters
- $request : \Psr\Http\Message\RequestInterface
Exceptions
Throws RouteException
setDefaultValue()
Sets a key of the Router::defaultValues array
Parameters
- $key : string
The key shouldn't be a natural number
- $value : mixed
setDefaultValues()
Overwrites the Router::defaultValues array
Parameters
- $defaultValues : array<string, mixed>
The keys of this array shouldn't be natural numbers
