class UriTemplate (View source)

Represents a URI Template as per http://tools.ietf.org/html/rfc6570

Properties

static protected array $variables
static protected array $operators
static protected array $delimiters
static protected array $encodedDelimiters

Methods

static string
expand(string $template, array $variables)

Expand the template string using the supplied variables

static string
expandMatch(array $matches)

Process an expansion

static array
parseExpression(string $expression)

Parse an expression into parts

static string
encodeArrayVariable(array $variable, array $value, string $operator, string $separator, bool $useQueryString)

Encode arrays for use in the expanded URI string

static bool
isAssociative(array $array)

Determines if an array is associative, i.e. contains at least one key that is a string.

static string
decodeReservedDelimiters(string $string)

Decodes percent encoding on delimiters (used with + and # modifiers)

Details

static string expand(string $template, array $variables)

Expand the template string using the supplied variables

Parameters

string $template

URI template to expand

array $variables

variables to use with the expansion

Return Value

string

static protected string expandMatch(array $matches)

Process an expansion

Parameters

array $matches

matches found in preg_replace_callback

Return Value

string

replacement string

static protected array parseExpression(string $expression)

Parse an expression into parts

Parameters

string $expression

Expression to parse

Return Value

array

associative array of parts

static protected string encodeArrayVariable(array $variable, array $value, string $operator, string $separator, bool $useQueryString)

Encode arrays for use in the expanded URI string

Parameters

array $variable
array $value
string $operator
string $separator
bool $useQueryString

Return Value

string

static protected bool isAssociative(array $array)

Determines if an array is associative, i.e. contains at least one key that is a string.

Parameters

array $array

Return Value

bool

static protected string decodeReservedDelimiters(string $string)

Decodes percent encoding on delimiters (used with + and # modifiers)

Parameters

string $string

Return Value

string