Class ArrayNode
A PHP array, e.g. array(1, 3, 'banana', 'apple')
-
Pharborist\Node
implements
Pharborist\NodeInterface
-
Pharborist\ParentNode
implements
Pharborist\ParentNodeInterface
-
Pharborist\Types\ArrayNode
implements
Pharborist\ExpressionNode
uses
Pharborist\ParenTrait
Methods summary
public
Pharborist\CommaListNode
|
|
public
Pharborist\NodeCollection |Pharborist\Types\ArrayElementNode[]
|
|
public
boolean
|
#
isMultidimensional( )
Tests if the array contains another array.
Tests if the array contains another array.
Returns
boolean
|
public
array
|
#
toValue( )
Convert to PHP array.
Returns
array Array of scalars.
Throws
BadMethodCallException Thrown if array contains non scalar elements.
|
public
boolean
|
#
hasKey( mixed $key, boolean $recursive = TRUE )
Returns if the array has a specific key.
Returns if the array has a specific key.
Parameters
- $key
Either a scalar value ('foo') or an ExpressionNode representing the key.
If $key is an ExpressionNode, the key's string representation is compared
with the string representations of the array keys. Otherwise, the actual
value is compared.
- $recursive
- Whether or not to check every level of the array.
Returns
boolean
Throws
InvalidArgumentException
|
public
Pharborist\NodeCollection
|
#
getKeys( boolean $recursive = TRUE )
Get the keys of the array.
Get the keys of the array.
Parameters
- $recursive
- (optional) TRUE to get keys of array elements that are also arrays.
Returns
|
public
Pharborist\NodeCollection
|
#
getValues( boolean $recursive = TRUE )
Get the values of the array.
Get the values of the array.
Parameters
- $recursive
- (optional) TRUE to get values of array elements that are also arrays.
Returns
|
public static
Pharborist\Types\ArrayNode
|
|
Methods inherited from Pharborist\ParentNode
__clone(),
__toString(),
acceptVisitor(),
addChild(),
addChildren(),
append(),
childCount(),
children(),
clear(),
find(),
firstChild(),
firstToken(),
getSourcePosition(),
getText(),
getTree(),
has(),
isDescendant(),
isEmpty(),
lastChild(),
lastToken(),
mergeNode(),
prepend(),
walk()
|
Methods inherited from Pharborist\Node
after(),
appendTo(),
before(),
closest(),
fromValue(),
furthest(),
getLogicalBlock(),
getRoot(),
getStatement(),
hasRoot(),
index(),
insertAfter(),
insertBefore(),
is(),
isAllOf(),
isAnyOf(),
next(),
nextAll(),
nextToken(),
nextUntil(),
parent(),
parents(),
parentsUntil(),
prependTo(),
previous(),
previousAll(),
previousToken(),
previousUntil(),
remove(),
replaceAll(),
replaceWith(),
siblings(),
sortKey(),
swapWith()
|