UriTemplate
in package
Defines the URI Template syntax and the process for expanding a URI Template into a URI reference.
Tags
Table of Contents
- $defaultVariables : VariableBag
- $template : Template
- __construct() : mixed
- __set_state() : self
- expand() : UriInterface
- getDefaultVariables() : array<string, string|array>
- Returns the default values used to expand the template.
- getTemplate() : string
- The template string.
- getVariableNames() : array<string|int, string>
- Returns the names of the variables in the template, in order.
- withDefaultVariables() : self
- Returns a new instance with the updated default variables.
- filterVariables() : VariableBag
- Filters out variables for the given template.
Properties
$defaultVariables
private
VariableBag
$defaultVariables
$template
private
Template
$template
Methods
__construct()
public
__construct(object|string $template[, array<string|int, mixed> $defaultVariables = [] ]) : mixed
Parameters
- $template : object|string
-
a string or an object with the __toString method
- $defaultVariables : array<string|int, mixed> = []
Tags
Return values
mixed —__set_state()
public
static __set_state(array<string|int, mixed> $properties) : self
Parameters
- $properties : array<string|int, mixed>
Return values
self —expand()
public
expand([array<string|int, mixed> $variables = [] ]) : UriInterface
Parameters
- $variables : array<string|int, mixed> = []
Tags
Return values
UriInterface —getDefaultVariables()
Returns the default values used to expand the template.
public
getDefaultVariables() : array<string, string|array>
The returned list only contains variables whose name is part of the current template.
Return values
array<string, string|array> —getTemplate()
The template string.
public
getTemplate() : string
Return values
string —getVariableNames()
Returns the names of the variables in the template, in order.
public
getVariableNames() : array<string|int, string>
Return values
array<string|int, string> —withDefaultVariables()
Returns a new instance with the updated default variables.
public
withDefaultVariables(array<string|int, mixed> $defaultDefaultVariables) : self
This method MUST retain the state of the current instance, and return an instance that contains the modified default variables.
If present, variables whose name is not part of the current template possible variable names are removed.
Parameters
- $defaultDefaultVariables : array<string|int, mixed>
Return values
self —filterVariables()
Filters out variables for the given template.
private
filterVariables(array<string, string|string[]> $variables) : VariableBag
Parameters
- $variables : array<string, string|string[]>