UriTemplate
in package
Implementation of levels 1-3 of the URI Template spec.
Tags
Table of Contents
Constants
- TYPE_LIST = "2"
- TYPE_MAP = "1"
- TYPE_SCALAR = "4"
Properties
- $operators : mixed
- $reserved : reserved
- $reservedEncoded : mixed
Methods
- combine() : mixed
- parse() : mixed
- combineList() : mixed
- Utility function that merges multiple combine calls for multi-key templates.
- getDataType() : mixed
- Return the type of a passed in value
- getValue() : mixed
- Utility function to encode and trim values
- replace() : mixed
- replaceVars() : mixed
- resolveNextSection() : mixed
- This function finds the first matching {...} block and executes the replacement. It then calls itself to find subsequent blocks, if any.
Constants
TYPE_LIST
public
mixed
TYPE_LIST
= "2"
TYPE_MAP
public
mixed
TYPE_MAP
= "1"
TYPE_SCALAR
public
mixed
TYPE_SCALAR
= "4"
Properties
$operators
private
mixed
$operators
= array("+" => "reserved", "/" => "segments", "." => "dotprefix", "#" => "fragment", ";" => "semicolon", "?" => "form", "&" => "continuation")
Tags
$reserved
private
reserved
$reserved
= array("=", ",", "!", "@", "|", ":", "/", "?", "#", "[", "]", '$', "&", "'", "(", ")", "*", "+", ";")
array These are the characters which should not be URL encoded in reserved strings.
$reservedEncoded
private
mixed
$reservedEncoded
= array("%3D", "%2C", "%21", "%40", "%7C", "%3A", "%2F", "%3F", "%23", "%5B", "%5D", "%24", "%26", "%27", "%28", "%29", "%2A", "%2B", "%3B")
Methods
combine()
public
combine(mixed $key, mixed $parameters, mixed $sep, mixed $combine, mixed $reserved, mixed $tag_empty, mixed $combine_on_empty) : mixed
Parameters
- $key : mixed
- $parameters : mixed
- $sep : mixed
- $combine : mixed
- $reserved : mixed
- $tag_empty : mixed
- $combine_on_empty : mixed
parse()
public
parse(mixed $string, array<string|int, mixed> $parameters) : mixed
Parameters
- $string : mixed
- $parameters : array<string|int, mixed>
combineList()
Utility function that merges multiple combine calls for multi-key templates.
private
combineList(mixed $vars, mixed $sep, mixed $parameters, mixed $combine, mixed $reserved, mixed $tag_empty, mixed $combine_on_empty) : mixed
Parameters
- $vars : mixed
- $sep : mixed
- $parameters : mixed
- $combine : mixed
- $reserved : mixed
- $tag_empty : mixed
- $combine_on_empty : mixed
getDataType()
Return the type of a passed in value
private
getDataType(mixed $data) : mixed
Parameters
- $data : mixed
getValue()
Utility function to encode and trim values
private
getValue(mixed $value, mixed $length) : mixed
Parameters
- $value : mixed
- $length : mixed
replace()
private
replace(mixed $string, mixed $start, mixed $end, mixed $parameters) : mixed
Parameters
- $string : mixed
- $start : mixed
- $end : mixed
- $parameters : mixed
replaceVars()
private
replaceVars(mixed $section, mixed $parameters[, mixed $sep = "," ][, mixed $combine = null ][, mixed $reserved = false ][, mixed $tag_empty = false ][, mixed $combine_on_empty = true ]) : mixed
Parameters
- $section : mixed
- $parameters : mixed
- $sep : mixed = ","
- $combine : mixed = null
- $reserved : mixed = false
- $tag_empty : mixed = false
- $combine_on_empty : mixed = true
resolveNextSection()
This function finds the first matching {...} block and executes the replacement. It then calls itself to find subsequent blocks, if any.
private
resolveNextSection(mixed $string, mixed $parameters) : mixed
Parameters
- $string : mixed
- $parameters : mixed