TraceableUrlMatcher
extends UrlMatcher
in package
TraceableUrlMatcher helps debug path info matching by tracing the match.
Tags
Table of Contents
Constants
- REQUIREMENT_MATCH = 0
- REQUIREMENT_MISMATCH = 1
- ROUTE_ALMOST_MATCHES = 1
- ROUTE_DOES_NOT_MATCH = 0
- ROUTE_MATCH = 2
- ROUTE_MATCHES = 2
Properties
- $allow : mixed
- Collects HTTP methods that would be allowed for the request.
- $context : RequestContext
- $expressionLanguage : mixed
- $expressionLanguageProviders : array<string|int, ExpressionFunctionProviderInterface>
- $request : mixed
- $routes : mixed
- $traces : mixed
Methods
- __construct() : mixed
- addExpressionLanguageProvider() : void
- getContext() : RequestContext
- Gets the request context.
- getTraces() : array<string|int, mixed>
- getTracesForRequest() : array<string|int, mixed>
- match() : array<string|int, mixed>
- Tries to match a URL path with a set of routes.
- matchRequest() : array<string|int, mixed>
- Tries to match a request with a set of routes.
- setContext() : void
- Sets the request context.
- getAttributes() : array<string|int, mixed>
- Returns an array of values to use as request attributes.
- getExpressionLanguage() : ExpressionLanguage
- handleRouteRequirements() : array<string|int, mixed>
- Handles specific route requirements.
- matchCollection() : array<string|int, mixed>
- Tries to match a URL with a set of routes.
- mergeDefaults() : array<string|int, mixed>
- Get merged default parameters.
- addTrace() : void
Constants
REQUIREMENT_MATCH
public
mixed
REQUIREMENT_MATCH
= 0
REQUIREMENT_MISMATCH
public
mixed
REQUIREMENT_MISMATCH
= 1
ROUTE_ALMOST_MATCHES
public
mixed
ROUTE_ALMOST_MATCHES
= 1
ROUTE_DOES_NOT_MATCH
public
mixed
ROUTE_DOES_NOT_MATCH
= 0
ROUTE_MATCH
public
mixed
ROUTE_MATCH
= 2
ROUTE_MATCHES
public
mixed
ROUTE_MATCHES
= 2
Properties
$allow
Collects HTTP methods that would be allowed for the request.
protected
mixed
$allow
= []
$context
protected
RequestContext
$context
$expressionLanguage
protected
mixed
$expressionLanguage
$expressionLanguageProviders
protected
array<string|int, ExpressionFunctionProviderInterface>
$expressionLanguageProviders
= []
$request
protected
mixed
$request
$routes
protected
mixed
$routes
$traces
protected
mixed
$traces
Methods
__construct()
public
__construct(RouteCollection $routes, RequestContext $context) : mixed
Parameters
- $routes : RouteCollection
- $context : RequestContext
addExpressionLanguageProvider()
public
addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) : void
Parameters
- $provider : ExpressionFunctionProviderInterface
getContext()
Gets the request context.
public
getContext() : RequestContext
Return values
RequestContextgetTraces()
public
getTraces(string $pathinfo) : array<string|int, mixed>
Parameters
- $pathinfo : string
Return values
array<string|int, mixed>getTracesForRequest()
public
getTracesForRequest(Request $request) : array<string|int, mixed>
Parameters
- $request : Request
Return values
array<string|int, mixed>match()
Tries to match a URL path with a set of routes.
public
match(string $pathinfo) : array<string|int, mixed>
If the matcher cannot find information, it must throw one of the exceptions documented below.
Parameters
- $pathinfo : string
-
The path info to be parsed (raw format, i.e. not urldecoded)
Return values
array<string|int, mixed>matchRequest()
Tries to match a request with a set of routes.
public
matchRequest(Request $request) : array<string|int, mixed>
If the matcher cannot find information, it must throw one of the exceptions documented below.
Parameters
- $request : Request
Return values
array<string|int, mixed>setContext()
Sets the request context.
public
setContext(RequestContext $context) : void
Parameters
- $context : RequestContext
getAttributes()
Returns an array of values to use as request attributes.
protected
getAttributes(Route $route, string $name, array<string|int, mixed> $attributes) : array<string|int, mixed>
As this method requires the Route object, it is not available in matchers that do not have access to the matched Route instance (like the PHP and Apache matcher dumpers).
Parameters
- $route : Route
- $name : string
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed>getExpressionLanguage()
protected
getExpressionLanguage() : ExpressionLanguage
Return values
ExpressionLanguagehandleRouteRequirements()
Handles specific route requirements.
protected
handleRouteRequirements(string $pathinfo, string $name, Route $route) : array<string|int, mixed>
Parameters
- $pathinfo : string
- $name : string
- $route : Route
Return values
array<string|int, mixed> —The first element represents the status, the second contains additional information
matchCollection()
Tries to match a URL with a set of routes.
protected
matchCollection(string $pathinfo, RouteCollection $routes) : array<string|int, mixed>
Parameters
- $pathinfo : string
-
The path info to be parsed
- $routes : RouteCollection
Return values
array<string|int, mixed>mergeDefaults()
Get merged default parameters.
protected
mergeDefaults(array<string|int, mixed> $params, array<string|int, mixed> $defaults) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
- $defaults : array<string|int, mixed>
Return values
array<string|int, mixed>addTrace()
private
addTrace(string $log[, int $level = self::ROUTE_DOES_NOT_MATCH ][, string|null $name = null ][, Route|null $route = null ]) : void
Parameters
- $log : string
- $level : int = self::ROUTE_DOES_NOT_MATCH
- $name : string|null = null
- $route : Route|null = null