Overview

Namespaces

  • Pharborist
    • Constants
    • ControlStructures
    • Exceptions
    • Functions
    • Generators
    • Namespaces
    • Objects
    • Operators
    • Types
    • Variables

Classes

  • ArrayNode
  • ArrayPairNode
  • BooleanNode
  • FalseNode
  • FloatNode
  • HeredocNode
  • IntegerNode
  • InterpolatedStringNode
  • NullNode
  • StringNode
  • StringVariableNode
  • TrueNode

Interfaces

  • ArrayElementNode
  • ScalarNode
  • Overview
  • Namespace
  • Class

Class ArrayNode

A PHP array, e.g. array(1, 3, 'banana', 'apple')

Pharborist\Node implements Pharborist\NodeInterface
Extended by Pharborist\ParentNode implements Pharborist\ParentNodeInterface
Extended by Pharborist\Types\ArrayNode implements Pharborist\ExpressionNode uses Pharborist\ParenTrait
Namespace: Pharborist\Types
Located at Types/ArrayNode.php
Methods summary
public Pharborist\CommaListNode
# getElementList( )

Returns

Pharborist\CommaListNode
public Pharborist\NodeCollection|Pharborist\Types\ArrayElementNode[]
# getElements( )

Returns

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.

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

Pharborist\NodeCollection
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

Pharborist\NodeCollection
public static Pharborist\Types\ArrayNode
# create( Pharborist\Types\ArrayElementNode[] $elements )

Parameters

$elements
Array elements.

Returns

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()
Methods used from Pharborist\ParenTrait
getCloseParen(), getOpenParen()
Pharborist API documentation generated by ApiGen