Documentation

RouteUrlGenerator
in package

Table of Contents

$defaultParameters  : array<string|int, mixed>
The named parameter defaults.
$dontEncode  : array<string|int, mixed>
Characters that should not be URL encoded.
$request  : Request
The request instance.
$url  : UrlGenerator
The URL generator instance.
__construct()  : void
Create a new Route URL generator.
defaults()  : void
Set the default named parameters used by the URL generator.
to()  : string
Generate a URL for the given route.
addPortToDomain()  : string
Add the port to the domain if necessary.
addQueryString()  : mixed|string
Add a query string to the URI.
formatDomain()  : string
Format the domain and port for the route and request.
getNumericParameters()  : array<string|int, mixed>
Get the numeric parameters from a given list.
getRouteDomain()  : string
Get the formatted domain for a given route.
getRouteQueryString()  : string
Get the query string for a given route.
getRouteScheme()  : string
Get the scheme for the given route.
getStringParameters()  : array<string|int, mixed>
Get the string parameters from a given list.
replaceNamedParameters()  : string
Replace all of the named parameters in the path.
replaceRootParameters()  : string
Replace the parameters on the root path.
replaceRouteParameters()  : string
Replace all of the wildcard parameters for a route path.

Properties

$defaultParameters

The named parameter defaults.

public array<string|int, mixed> $defaultParameters = []

$dontEncode

Characters that should not be URL encoded.

public array<string|int, mixed> $dontEncode = ['%2F' => '/', '%40' => '@', '%3A' => ':', '%3B' => ';', '%2C' => ',', '%3D' => '=', '%2B' => '+', '%21' => '!', '%2A' => '*', '%7C' => '|', '%3F' => '?', '%26' => '&', '%23' => '#', '%25' => '%']

Methods

defaults()

Set the default named parameters used by the URL generator.

public defaults(array<string|int, mixed> $defaults) : void
Parameters
$defaults : array<string|int, mixed>
Return values
void

to()

Generate a URL for the given route.

public to(Route $route[, array<string|int, mixed> $parameters = [] ][, bool $absolute = false ]) : string
Parameters
$route : Route
$parameters : array<string|int, mixed> = []
$absolute : bool = false
Tags
throws
UrlGenerationException
Return values
string

addPortToDomain()

Add the port to the domain if necessary.

protected addPortToDomain(string $domain) : string
Parameters
$domain : string
Return values
string

addQueryString()

Add a query string to the URI.

protected addQueryString(string $uri, array<string|int, mixed> $parameters) : mixed|string
Parameters
$uri : string
$parameters : array<string|int, mixed>
Return values
mixed|string

formatDomain()

Format the domain and port for the route and request.

protected formatDomain(Route $route, array<string|int, mixed> &$parameters) : string
Parameters
$route : Route
$parameters : array<string|int, mixed>
Return values
string

getNumericParameters()

Get the numeric parameters from a given list.

protected getNumericParameters(array<string|int, mixed> $parameters) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
Return values
array<string|int, mixed>

getRouteDomain()

Get the formatted domain for a given route.

protected getRouteDomain(Route $route, array<string|int, mixed> &$parameters) : string
Parameters
$route : Route
$parameters : array<string|int, mixed>
Return values
string

getRouteQueryString()

Get the query string for a given route.

protected getRouteQueryString(array<string|int, mixed> $parameters) : string
Parameters
$parameters : array<string|int, mixed>
Return values
string

getRouteScheme()

Get the scheme for the given route.

protected getRouteScheme(Route $route) : string
Parameters
$route : Route
Return values
string

getStringParameters()

Get the string parameters from a given list.

protected getStringParameters(array<string|int, mixed> $parameters) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
Return values
array<string|int, mixed>

replaceNamedParameters()

Replace all of the named parameters in the path.

protected replaceNamedParameters(string $path, array<string|int, mixed> &$parameters) : string
Parameters
$path : string
$parameters : array<string|int, mixed>
Return values
string

replaceRootParameters()

Replace the parameters on the root path.

protected replaceRootParameters(Route $route, string $domain, array<string|int, mixed> &$parameters) : string
Parameters
$route : Route
$domain : string
$parameters : array<string|int, mixed>
Return values
string

replaceRouteParameters()

Replace all of the wildcard parameters for a route path.

protected replaceRouteParameters(string $path, array<string|int, mixed> &$parameters) : string
Parameters
$path : string
$parameters : array<string|int, mixed>
Return values
string

Search results