Expression
in package
Table of Contents
- OPERATOR_HASH_LOOKUP = ['' => ['prefix' => '', 'joiner' => ',', 'query' => false], '+' => ['prefix' => '', 'joiner' => ',', 'query' => false], '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false], '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false], '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false], ';' => ['prefix' => ';', 'joiner' => ';', 'query' => true], '?' => ['prefix' => '?', 'joiner' => '&', 'query' => true], '&' => ['prefix' => '&', 'joiner' => '&', 'query' => true]]
- Processing behavior according to the expression type operator.
- REGEXP_EXPRESSION = '/^\{ (?: (?<operator>[\.\/;\?&\=,\!@\|\+#])? (?<variables>[^\}]*) ) \}$/x'
- Expression regular expression pattern.
- RESERVED_OPERATOR = '=,!@|'
- Reserved Operator characters.
- $expressionString : string
- $joiner : string
- $operator : string
- $variableNames : array<string|int, mixed>
- $varSpecifiers : array<string|int, mixed>
- __set_state() : self
- {@inheritDoc}
- createFromString() : self
- expand() : string
- toString() : string
- Returns the expression string representation.
- variableNames() : array<string|int, string>
- __construct() : mixed
- decodeReserved() : string
- Removes percent encoding on reserved characters (used with + and # modifiers).
- inject() : array{0: string, 1: bool}
- isAssoc() : bool
- Determines if an array is associative.
- replace() : string
- Replaces an expression with the given variables.
- replaceList() : array{0: string, 1: bool}
- Expands an expression using a list of values.
- replaceString() : array{0: string, 1: bool}
- Expands an expression using a string value.
- setExpressionString() : string
- setVariableNames() : array<string|int, string>
Constants
OPERATOR_HASH_LOOKUP
Processing behavior according to the expression type operator.
private
mixed
OPERATOR_HASH_LOOKUP
= ['' => ['prefix' => '', 'joiner' => ',', 'query' => false], '+' => ['prefix' => '', 'joiner' => ',', 'query' => false], '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false], '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false], '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false], ';' => ['prefix' => ';', 'joiner' => ';', 'query' => true], '?' => ['prefix' => '?', 'joiner' => '&', 'query' => true], '&' => ['prefix' => '&', 'joiner' => '&', 'query' => true]]
Tags
REGEXP_EXPRESSION
Expression regular expression pattern.
private
mixed
REGEXP_EXPRESSION
= '/^\{
(?:
(?<operator>[\.\/;\?&\=,\!@\|\+#])?
(?<variables>[^\}]*)
)
\}$/x'
Tags
RESERVED_OPERATOR
Reserved Operator characters.
private
mixed
RESERVED_OPERATOR
= '=,!@|'
Tags
Properties
$expressionString
private
string
$expressionString
$joiner
private
string
$joiner
$operator
private
string
$operator
$variableNames
private
array<string|int, mixed>
$variableNames
$varSpecifiers
private
array<string|int, mixed>
$varSpecifiers
Methods
__set_state()
{@inheritDoc}
public
static __set_state(array<string|int, mixed> $properties) : self
Parameters
- $properties : array<string|int, mixed>
Return values
self —createFromString()
public
static createFromString(string $expression) : self
Parameters
- $expression : string
Tags
Return values
self —expand()
public
expand(VariableBag $variables) : string
Parameters
- $variables : VariableBag
Return values
string —toString()
Returns the expression string representation.
public
toString() : string
Return values
string —variableNames()
public
variableNames() : array<string|int, string>
Return values
array<string|int, string> —__construct()
private
__construct(string $operator, VarSpecifier ...$varSpecifiers) : mixed
Parameters
- $operator : string
- $varSpecifiers : VarSpecifier
Return values
mixed —decodeReserved()
Removes percent encoding on reserved characters (used with + and # modifiers).
private
decodeReserved(string $str) : string
Parameters
- $str : string
Return values
string —inject()
private
inject(string|array<string|int, string> $value, VarSpecifier $varSpec, bool $useQuery) : array{0: string, 1: bool}
Parameters
- $value : string|array<string|int, string>
- $varSpec : VarSpecifier
- $useQuery : bool
Return values
array{0: string, 1: bool} —isAssoc()
Determines if an array is associative.
private
isAssoc(array<string|int, mixed> $array) : bool
This makes the assumption that input arrays are sequences or hashes. This assumption is a trade-off for accuracy in favor of speed, but it should work in almost every case where input is supplied for a URI template.
Parameters
- $array : array<string|int, mixed>
Return values
bool —replace()
Replaces an expression with the given variables.
private
replace(VarSpecifier $varSpec, VariableBag $variables) : string
Parameters
- $varSpec : VarSpecifier
- $variables : VariableBag
Tags
Return values
string —replaceList()
Expands an expression using a list of values.
private
replaceList(array<string|int, string> $value, VarSpecifier $varSpec, bool $useQuery) : array{0: string, 1: bool}
Parameters
- $value : array<string|int, string>
- $varSpec : VarSpecifier
- $useQuery : bool
Tags
Return values
array{0: string, 1: bool} —replaceString()
Expands an expression using a string value.
private
replaceString(string $value, VarSpecifier $varSpec, bool $useQuery) : array{0: string, 1: bool}
Parameters
- $value : string
- $varSpec : VarSpecifier
- $useQuery : bool
Return values
array{0: string, 1: bool} —setExpressionString()
private
setExpressionString() : string
Return values
string —setVariableNames()
private
setVariableNames() : array<string|int, string>