ArrayEntryToken
in package
implements
TokenInterface
Array entry token.
Tags
Interfaces, Classes, Traits and Enums
- TokenInterface
- Argument token interface.
Table of Contents
- $key : TokenInterface
- $value : TokenInterface
- __construct() : mixed
- __toString() : string
- Returns string representation for token.
- getKey() : TokenInterface
- Returns key
- getValue() : TokenInterface
- Returns value
- isLast() : bool
- Returns false.
- scoreArgument() : bool|int
- Scores half of combined scores from key and value tokens for same entry. Capped at 8.
- convertArrayAccessToEntry() : array<string|int, mixed>|null
- Converts instance of \ArrayAccess to key => value array entry
- wrapIntoExactValueToken() : TokenInterface
- Wraps non token $value into ExactValueToken
Properties
$key
private
TokenInterface
$key
$value
private
TokenInterface
$value
Methods
__construct()
public
__construct(mixed $key, mixed $value) : mixed
Parameters
- $key : mixed
-
exact value or token
- $value : mixed
-
exact value or token
Return values
mixed —__toString()
Returns string representation for token.
public
__toString() : string
Return values
string —getKey()
Returns key
public
getKey() : TokenInterface
Return values
TokenInterface —getValue()
Returns value
public
getValue() : TokenInterface
Return values
TokenInterface —isLast()
Returns false.
public
isLast() : bool
Return values
bool —scoreArgument()
Scores half of combined scores from key and value tokens for same entry. Capped at 8.
public
scoreArgument(array<string|int, mixed>|ArrayAccess|Traversable $argument) : bool|int
If argument implements \ArrayAccess without \Traversable, then key token is restricted to ExactValueToken.
Parameters
- $argument : array<string|int, mixed>|ArrayAccess|Traversable
Tags
Return values
bool|int —convertArrayAccessToEntry()
Converts instance of \ArrayAccess to key => value array entry
private
convertArrayAccessToEntry(ArrayAccess $object) : array<string|int, mixed>|null
Parameters
- $object : ArrayAccess
Tags
Return values
array<string|int, mixed>|null —wrapIntoExactValueToken()
Wraps non token $value into ExactValueToken
private
wrapIntoExactValueToken( $value) : TokenInterface