com\setasign\SetaFramework\Router\Route
Regex Class Route Regex
File: /SetaFramework/src/Router/Route/Regex.php
Class hierarchy
Implements
- \Psr\Log\LoggerAwareInterface
- RouteInterface
Summary
Properties
$defaultValues
$requestPathPrefix
Methods
__construct()
array<string, mixed> $defaultValues = array ( ),
array<string, int|string> $map = array ( ),
?string $requestPathPrefix = null
Constructor
The regex route checks the path with a regular expression.
The regex will start after the requestPathPrefix ends (without a starting slash).
e.g.: prefix=/asdf/bcd ; path=/asdf/bcd/efg/kli ; path which will checked by regex=efg/kli
If the requestPathPrefix doesn't match the route will fail.
Parameters
- $regex : string
Regular expression
- $defaultValues : array<string, mixed>
- $map : array<string, int|string>
- $requestPathPrefix : ?string
Exceptions
Throws \InvalidArgumentException
match()
Checks whether this route matches to the request
Parameters
- $request : \Psr\Http\Message\RequestInterface
Return Values
Returns associative array(without any numeric key) with values or NULL if the route not match
Exceptions
Throws \com\setasign\SetaFramework\Router\RouteException If $request is no SetaFramework\Request\Http
See
setDefaultValue()
Sets a key of the defaultValues array
Parameters
- $key : string
The key shouldn't be a natural number
- $value : mixed
setDefaultValues()
Overwrites the defaultValues array
Parameters
- $defaultValues : array<string, mixed>
The keys of this array shouldn't be natural numbers
