Documentation

Parameters
in package

The parameters a route reads out of a server or URI. This allows the application to gracefully manage the parameters and give them over to the callback function that should replace it.

Table of Contents

$parameters  : array<string|int, string>
This parameters are used to handle named parameters that a URL has handled from a Server or URI.
$unparsed  : array<string|int, string>
Some components are greedy (this means, they accept incomplete routes or patterns as target for a string), the leftovers are stored in this array for the application to use at it's own discretion.
addParameter()  : mixed
Imports a set of parameters parsed by the router. Usually, this will be a single element provided by the route.
addParameters()  : mixed
Imports a set of parameters parsed by the router. Usually, this will be a single element provided by the route.
getParameter()  : string
Returns the parameter for the given parameter name. Please note that this function may return boolean false and empty strings alike. You can use the === operator to compare the values and check if the returned one was because the data was not set or empty.
getParameters()  : array<string|int, string>
Returns the list of parameters parsed from the URL path. Please note that every parameter is sent as a URL portion and therefore a string.
getUnparsed()  : array<string|int, string>
Return the list of URL components that were unaffected by a 'greedy' route.
merge()  : mixed
replaceInString()  : mixed
Replaces the parameters contained in this object in a string. This will look for prefixed versions of a kez and replace them with the key's value and then return the string.
setParameters()  : mixed
Sets the list of parameters this element holds. This is usually used internally to indicate what parameters where passed with the route.
setUnparsed()  : mixed
Allows to set the list of URL fragments that were sent with the request but were not parsed by the route. This function is usually called from within Spitfire's router to indicate the lack of a need for this elements.

Properties

$parameters

This parameters are used to handle named parameters that a URL has handled from a Server or URI.

private array<string|int, string> $parameters = array()

$unparsed

Some components are greedy (this means, they accept incomplete routes or patterns as target for a string), the leftovers are stored in this array for the application to use at it's own discretion.

private array<string|int, string> $unparsed = array()

For example, Spitfire's default rules make heavy use of this tool as a way to retrieve the controller, action and object from a request.

Methods

addParameter()

Imports a set of parameters parsed by the router. Usually, this will be a single element provided by the route.

public addParameter(mixed $key, mixed $value) : mixed
Parameters
$key : mixed
$value : mixed
Return values
mixed

addParameters()

Imports a set of parameters parsed by the router. Usually, this will be a single element provided by the route.

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

getParameter()

Returns the parameter for the given parameter name. Please note that this function may return boolean false and empty strings alike. You can use the === operator to compare the values and check if the returned one was because the data was not set or empty.

public getParameter(string $name) : string
Parameters
$name : string
Return values
string

getParameters()

Returns the list of parameters parsed from the URL path. Please note that every parameter is sent as a URL portion and therefore a string.

public getParameters() : array<string|int, string>
Return values
array<string|int, string>

getUnparsed()

Return the list of URL components that were unaffected by a 'greedy' route.

public getUnparsed() : array<string|int, string>

That means that the parsed route was longer than the parameters parsed the route parsed.

Return values
array<string|int, string>

merge()

public merge(mixed $with) : mixed
Parameters
$with : mixed
Return values
mixed

replaceInString()

Replaces the parameters contained in this object in a string. This will look for prefixed versions of a kez and replace them with the key's value and then return the string.

public replaceInString(string $string) : mixed
Parameters
$string : string

The string to search for matches and replace

Return values
mixed

setParameters()

Sets the list of parameters this element holds. This is usually used internally to indicate what parameters where passed with the route.

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

setUnparsed()

Allows to set the list of URL fragments that were sent with the request but were not parsed by the route. This function is usually called from within Spitfire's router to indicate the lack of a need for this elements.

public setUnparsed(array<string|int, string> $unparsed) : mixed

The content of this URL will be useful to you when defining greedy URLs.

Parameters
$unparsed : array<string|int, string>
Return values
mixed

Search results