W3cubDocs

/Symfony 4.1

RedirectableUrlMatcher

abstract class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface

Constants

REQUIREMENT_MATCH
REQUIREMENT_MISMATCH
ROUTE_MATCH

Properties

protected $context from UrlMatcher
protected $allow Collects HTTP methods that would be allowed for the request. from UrlMatcher
protected $allowSchemes Collects URI schemes that would be allowed for the request. from UrlMatcher
protected $routes from UrlMatcher
protected $request from UrlMatcher
protected $expressionLanguage from UrlMatcher
protected ExpressionFunctionProviderInterface[] $expressionLanguageProviders from UrlMatcher

Methods

__construct(RouteCollection $routes, RequestContext $context) from UrlMatcher
setContext(RequestContext $context)

Sets the request context.

from UrlMatcher
RequestContext getContext()

Gets the request context.

from UrlMatcher
array match(string $pathinfo)

Tries to match a URL path with a set of routes.

array matchRequest(Request $request)

Tries to match a request with a set of routes.

from UrlMatcher
addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider) from UrlMatcher
array matchCollection(string $pathinfo, RouteCollection $routes)

Tries to match a URL with a set of routes.

from UrlMatcher
array getAttributes(Route $route, string $name, array $attributes)

Returns an array of values to use as request attributes.

from UrlMatcher
array handleRouteRequirements(string $pathinfo, string $name, Route $route)

Handles specific route requirements.

from UrlMatcher
array mergeDefaults(array $params, array $defaults)

Get merged default parameters.

from UrlMatcher
getExpressionLanguage() from UrlMatcher
createRequest($pathinfo) from UrlMatcher

Details

__construct(RouteCollection $routes, RequestContext $context)

Parameters

RouteCollection $routes
RequestContext $context

setContext(RequestContext $context)

Sets the request context.

Parameters

RequestContext $context

RequestContext getContext()

Gets the request context.

Return Value

RequestContext The context

array match(string $pathinfo)

Tries to match a URL path with a set of routes.

If the matcher can not find information, it must throw one of the exceptions documented below.

Parameters

string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded)

Return Value

array An array of parameters

Exceptions

NoConfigurationException If no routing configuration could be found
ResourceNotFoundException If the resource could not be found
MethodNotAllowedException If the resource was found but the request method is not allowed

array matchRequest(Request $request)

Tries to match a request with a set of routes.

If the matcher can not find information, it must throw one of the exceptions documented below.

Parameters

Request $request

Return Value

array An array of parameters

Exceptions

NoConfigurationException If no routing configuration could be found
ResourceNotFoundException If no matching resource could be found
MethodNotAllowedException If a matching resource was found but the request method is not allowed

addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)

Parameters

ExpressionFunctionProviderInterface $provider

protected array matchCollection(string $pathinfo, RouteCollection $routes)

Tries to match a URL with a set of routes.

Parameters

string $pathinfo The path info to be parsed
RouteCollection $routes The set of routes

Return Value

array An array of parameters

Exceptions

NoConfigurationException If no routing configuration could be found
ResourceNotFoundException If the resource could not be found
MethodNotAllowedException If the resource was found but the request method is not allowed

protected array getAttributes(Route $route, string $name, array $attributes)

Returns an array of values to use as request attributes.

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 The route we are matching against
string $name The name of the route
array $attributes An array of attributes from the matcher

Return Value

array An array of parameters

protected array handleRouteRequirements(string $pathinfo, string $name, Route $route)

Handles specific route requirements.

Parameters

string $pathinfo The path
string $name The route name
Route $route The route

Return Value

array The first element represents the status, the second contains additional information

protected array mergeDefaults(array $params, array $defaults)

Get merged default parameters.

Parameters

array $params The parameters
array $defaults The defaults

Return Value

array Merged default parameters

protected getExpressionLanguage()

protected createRequest($pathinfo)

Parameters

$pathinfo

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.html