Overview

Namespaces

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

Classes

  • ArrayLookupNode
  • BacktickNode
  • BlankStatementNode
  • CommaListNode
  • CommentNode
  • DocCommentNode
  • EchoStatementNode
  • EchoTagStatementNode
  • ExpressionStatementNode
  • Filter
  • Formatter
  • FormatterFactory
  • LineCommentBlockNode
  • Node
  • NodeCollection
  • OperatorFactory
  • ParenthesisNode
  • ParentNode
  • Parser
  • PartialCommentNode
  • PartialNode
  • RootNode
  • SourceDiscovery
  • SourcePosition
  • SplatNode
  • StatementBlockNode
  • StatementNode
  • TemplateNode
  • Token
  • TokenIterator
  • Tokenizer
  • TokenNode
  • UnsetStatementNode
  • VisitorBase
  • WhitespaceNode

Interfaces

  • ExpressionNode
  • NodeInterface
  • ParentNodeInterface
  • ParserException
  • VisitorInterface

Traits

  • DocCommentTrait
  • ParenTrait
  • UncommentTrait
  • Overview
  • Namespace
  • Class

Class ArrayLookupNode

An array lookup.

For example $array[0]

Pharborist\Node implements Pharborist\NodeInterface
Extended by Pharborist\ParentNode implements Pharborist\ParentNodeInterface
Extended by Pharborist\ArrayLookupNode implements Pharborist\Variables\VariableExpressionNode
Namespace: Pharborist
Located at ArrayLookupNode.php
Methods summary
public static static
# create( Pharborist\ExpressionNode $array, Pharborist\ExpressionNode $key )

Creates a new array lookup.

Creates a new array lookup.

Parameters

$array
The expression representing the array (usually a VariableNode).
$key
The expression representing the key (usually a string).

Returns

static
public Pharborist\Node
# getArray( )

Returns

Pharborist\Node
public Pharborist\Node[]
# getKeys( )

Returns

Pharborist\Node[]
public Pharborist\Node
# getKey( integer $index = 0 )

Returns a specific key in the lookup.

Returns a specific key in the lookup.

Parameters

$index
The index of the key to return.

Returns

Pharborist\Node

Throws

InvalidArgumentException

if $index is not an integer. \OutOfBoundsException if $index is less than zero or greater than the number of keys in the lookup.

public boolean
# hasScalarKeys( )

Returns TRUE if all keys in the lookup are scalar. So a lookup like $foo['bar']['baz'][0] will be TRUE, but $foo[$bar]['baz'][0] won't.

Returns TRUE if all keys in the lookup are scalar. So a lookup like $foo['bar']['baz'][0] will be TRUE, but $foo[$bar]['baz'][0] won't.

Returns

boolean
public mixed[]
# extractKeys( )

Returns every key in the lookup. For example, $foo['bar']['baz'][5] will return ['bar', 'baz', 5].

Returns every key in the lookup. For example, $foo['bar']['baz'][5] will return ['bar', 'baz', 5].

Returns

mixed[]

Throws

DomainException
if the lookup contains any non-scalar keys.
public Pharborist\Node
# getRootArray( )

Returns the root of the lookup.

Returns the root of the lookup.

For example, given an expression like $foo['bar']['baz'], this method will return a VariableNode for $foo.

Returns

Pharborist\Node
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()
Pharborist API documentation generated by ApiGen