Documentation

ArrayEntryToken
in package
implements TokenInterface

Array entry token.

Tags
author

Boris Mikhaylov kaguxmail@gmail.com

Interfaces, Classes and Traits

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

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

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
throws
InvalidArgumentException
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
throws
InvalidArgumentException
Return values
array<string|int, mixed>|null

Search results