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 ParentNode

A node that has children.

Pharborist\Node implements Pharborist\NodeInterface
Extended by Pharborist\ParentNode implements Pharborist\ParentNodeInterface

Direct known subclasses

Pharborist\ArrayLookupNode, Pharborist\BacktickNode, Pharborist\Exceptions\CatchNode, Pharborist\Functions\AnonymousFunctionNode, Pharborist\Functions\CallNode, Pharborist\Functions\ParameterNode, Pharborist\Generators\YieldNode, Pharborist\LineCommentBlockNode, Pharborist\Namespaces\NameNode, Pharborist\Namespaces\UseDeclarationNode, Pharborist\Objects\ClassConstantLookupNode, Pharborist\Objects\ClassMemberLookupNode, Pharborist\CommaListNode, Pharborist\Objects\ClassMemberNode, Pharborist\Objects\ClassNameScalarNode, Pharborist\Objects\NameExpressionNode, Pharborist\Objects\NewNode, Pharborist\Objects\ObjectPropertyNode, Pharborist\Objects\TraitMethodReferenceNode, Pharborist\Operators\BinaryOperationNode, Pharborist\Operators\TernaryOperationNode, Pharborist\Operators\UnaryOperationNode, Pharborist\ParenthesisNode, Pharborist\Constants\ConstantDeclarationNode, Pharborist\PartialNode, Pharborist\SplatNode, Pharborist\StatementBlockNode, Pharborist\StatementNode, Pharborist\TemplateNode, Pharborist\Types\ArrayNode, Pharborist\Types\ArrayPairNode, Pharborist\Types\HeredocNode, Pharborist\Types\InterpolatedStringNode, Pharborist\Types\StringVariableNode, Pharborist\Constants\ConstantNode, Pharborist\Variables\CompoundVariableNode, Pharborist\Variables\ReferenceVariableNode, Pharborist\Variables\StaticVariableNode, Pharborist\Variables\VariableVariableNode, Pharborist\ControlStructures\DeclareDirectiveNode, Pharborist\ControlStructures\ElseIfNode, Pharborist\ControlStructures\ExitNode, Pharborist\ControlStructures\GotoLabelNode, Pharborist\ControlStructures\ImportNode

Indirect known subclasses

Pharborist\BlankStatementNode, Pharborist\Constants\ConstantDeclarationStatementNode, Pharborist\ControlStructures\GotoStatementNode, Pharborist\Operators\PostDecrementNode, Pharborist\Operators\PostIncrementNode, Pharborist\Operators\PowerAssignNode, Pharborist\Operators\PowerNode, Pharborist\Operators\PreDecrementNode, Pharborist\Operators\PreIncrementNode, Pharborist\Operators\PrintNode, Pharborist\Operators\StringCastNode, Pharborist\Operators\SubtractAssignNode, Pharborist\Operators\SubtractNode, Pharborist\ControlStructures\IfNode, Pharborist\Operators\SuppressWarningNode, Pharborist\Operators\UnsetCastNode, Pharborist\PartialCommentNode, Pharborist\RootNode, Pharborist\Types\BooleanNode, Pharborist\Types\FalseNode, Pharborist\Types\NullNode, Pharborist\Types\TrueNode, Pharborist\UnsetStatementNode, Pharborist\Variables\GlobalStatementNode, Pharborist\ControlStructures\IncludeNode, Pharborist\Variables\StaticVariableStatementNode, Pharborist\ControlStructures\IncludeOnceNode, Pharborist\ControlStructures\RequireNode, Pharborist\ControlStructures\RequireOnceNode, Pharborist\ControlStructures\ReturnStatementNode, Pharborist\ControlStructures\SwitchNode, Pharborist\ControlStructures\WhileNode, Pharborist\EchoStatementNode, Pharborist\ControlStructures\BreakStatementNode, Pharborist\EchoTagStatementNode, Pharborist\Exceptions\ThrowStatementNode, Pharborist\Exceptions\TryCatchNode, Pharborist\ExpressionStatementNode, Pharborist\Functions\CallbackCallNode, Pharborist\Functions\DefineNode, Pharborist\Functions\EmptyNode, Pharborist\Functions\EvalNode, Pharborist\Functions\FunctionCallNode, Pharborist\Functions\FunctionDeclarationNode, Pharborist\ControlStructures\CaseNode, Pharborist\Functions\HaltCompilerNode, Pharborist\Functions\IssetNode, Pharborist\Functions\ListNode, Pharborist\Functions\UnsetNode, Pharborist\Generators\YieldStatementNode, Pharborist\Namespaces\NamespaceNode, Pharborist\Namespaces\UseDeclarationBlockNode, Pharborist\Namespaces\UseDeclarationStatementNode, Pharborist\Objects\ClassMemberListNode, Pharborist\Objects\ClassMethodCallNode, Pharborist\ControlStructures\ContinueStatementNode, Pharborist\Objects\ClassMethodNode, Pharborist\Objects\ClassNode, Pharborist\Objects\ClassStatementNode, Pharborist\Objects\InterfaceMethodNode, Pharborist\Objects\InterfaceNode, Pharborist\Objects\ObjectMethodCallNode, Pharborist\Objects\SingleInheritanceNode, Pharborist\Objects\TraitAdaptationStatementNode, Pharborist\Objects\TraitAliasNode, Pharborist\Objects\TraitNode, Pharborist\ControlStructures\DeclareNode, Pharborist\Objects\TraitPrecedenceNode, Pharborist\Objects\TraitUseNode, Pharborist\Operators\AddAssignNode, Pharborist\Operators\AddNode, Pharborist\Operators\ArrayCastNode, Pharborist\Operators\AssignNode, Pharborist\Operators\AssignReferenceNode, Pharborist\Operators\BitwiseAndAssignNode, Pharborist\Operators\BitwiseAndNode, Pharborist\Operators\BitwiseNotNode, Pharborist\ControlStructures\DefaultNode, Pharborist\Operators\BitwiseOrAssignNode, Pharborist\Operators\BitwiseOrNode, Pharborist\Operators\BitwiseShiftLeftAssignNode, Pharborist\Operators\BitwiseShiftLeftNode, Pharborist\Operators\BitwiseShiftRightAssignNode, Pharborist\Operators\BitwiseShiftRightNode, Pharborist\Operators\BitwiseXorAssignNode, Pharborist\Operators\BitwiseXorNode, Pharborist\Operators\BooleanAndNode, Pharborist\Operators\BooleanCastNode, Pharborist\ControlStructures\DoWhileNode, Pharborist\Operators\BooleanNotNode, Pharborist\Operators\BooleanOrNode, Pharborist\Operators\CastNode, Pharborist\Operators\CloneNode, Pharborist\Operators\ConcatAssignNode, Pharborist\Operators\ConcatNode, Pharborist\Operators\DivideAssignNode, Pharborist\Operators\DivideNode, Pharborist\Operators\ElvisNode, Pharborist\Operators\EqualNode, Pharborist\ControlStructures\ForeachNode, Pharborist\Operators\FloatCastNode, Pharborist\Operators\GreaterThanNode, Pharborist\Operators\GreaterThanOrEqualToNode, Pharborist\Operators\IdenticalNode, Pharborist\Operators\InstanceOfNode, Pharborist\Operators\IntegerCastNode, Pharborist\Operators\LessThanNode, Pharborist\Operators\LessThanOrEqualToNode, Pharborist\Operators\LogicalAndNode, Pharborist\Operators\LogicalOrNode, Pharborist\ControlStructures\ForNode, Pharborist\Operators\LogicalXorNode, Pharborist\Operators\ModulusAssignNode, Pharborist\Operators\ModulusNode, Pharborist\Operators\MultiplyAssignNode, Pharborist\Operators\MultiplyNode, Pharborist\Operators\NegateNode, Pharborist\Operators\NotEqualNode, Pharborist\Operators\NotIdenticalNode, Pharborist\Operators\ObjectCastNode, Pharborist\Operators\PlusNode
Abstract
Namespace: Pharborist
Located at ParentNode.php
Methods summary
public
# isEmpty( )
public integer
# childCount( )

Get the number of children.

Get the number of children.

Returns

integer

Implementation of

Pharborist\ParentNodeInterface::childCount()
public Pharborist\Node
# firstChild( )

Return the first child.

Return the first child.

Returns

Pharborist\Node

Implementation of

Pharborist\ParentNodeInterface::firstChild()
public Pharborist\Node
# lastChild( )

Return the last child.

Return the last child.

Returns

Pharborist\Node

Implementation of

Pharborist\ParentNodeInterface::lastChild()
public Pharborist\NodeCollection
# children( callable $callback = NULL )

Get the immediate children of this node.

Get the immediate children of this node.

Parameters

$callback
An optional callback to filter by.

Returns

Pharborist\NodeCollection

Implementation of

Pharborist\ParentNodeInterface::children()
public
# clear( )

Remove all child nodes.

Remove all child nodes.

Implementation of

Pharborist\ParentNodeInterface::clear()
public
# prepend( Pharborist\Node|Pharborist\Node[]|Pharborist\NodeCollection $nodes )

Prepend nodes to this node.

Prepend nodes to this node.

Parameters

$nodes

Returns


$this

Throws

InvalidArgumentException

Implementation of

Pharborist\ParentNodeInterface::prepend()
public
# addChild( Pharborist\Node $node, string $property_name = NULL )

Add a child to node.

Add a child to node.

Internal use only, used by parser when building a node.

Parameters

$node
$property_name

Returns


$this
public
# addChildren( array $children )

Add children to node.

Add children to node.

Internal use only, used by parser when building a node.

Parameters

$children
public
# mergeNode( Pharborist\ParentNode $node )

Merge another parent node into this node.

Merge another parent node into this node.

Parameters

$node
public
# append( Pharborist\Node|Pharborist\Node[]|Pharborist\NodeCollection $nodes )

Append nodes to this node.

Append nodes to this node.

Parameters

$nodes

Returns


$this

Throws

InvalidArgumentException

Implementation of

Pharborist\ParentNodeInterface::append()
public Pharborist\TokenNode
# firstToken( )

Get the first (i.e. leftmost leaf) token.

Get the first (i.e. leftmost leaf) token.

Returns

Pharborist\TokenNode

Implementation of

Pharborist\ParentNodeInterface::firstToken()
public Pharborist\TokenNode
# lastToken( )

Get the last (i.e. rightmost leaf) token.

Get the last (i.e. rightmost leaf) token.

Returns

Pharborist\TokenNode

Implementation of

Pharborist\ParentNodeInterface::lastToken()
public Pharborist\NodeCollection
# has( callable $callback )

Test if the node has a descendant that matches.

Test if the node has a descendant that matches.

Parameters

$callback
Callback to test for match.

Returns

Pharborist\NodeCollection

Implementation of

Pharborist\ParentNodeInterface::has()
public boolean
# isDescendant( Pharborist\Node $node )

Test if the node is a descendant of this node.

Test if the node is a descendant of this node.

Parameters

$node
Node to test

Returns

boolean

Implementation of

Pharborist\ParentNodeInterface::isDescendant()
public Pharborist\NodeCollection
# find( callable $callback )

Find descendants that pass filter callback.

Find descendants that pass filter callback.

Parameters

$callback
Callback to filter by.

Returns

Pharborist\NodeCollection

Implementation of

Pharborist\ParentNodeInterface::find()
public
# walk( callable $callback )

Perform callback on this node and all descendant nodes.

Perform callback on this node and all descendant nodes.

Parameters

$callback
Callback for each node.

Implementation of

Pharborist\ParentNodeInterface::walk()
public
# acceptVisitor( Pharborist\VisitorInterface $visitor )
public Pharborist\SourcePosition
# getSourcePosition( )

Get the source position of the node.

Get the source position of the node.

Returns

Pharborist\SourcePosition

Implementation of

Pharborist\NodeInterface::getSourcePosition()
public
# __clone( )

Overrides

Pharborist\Node::__clone()
public string
# getText( )

Convert the node into PHP source code.

Convert the node into PHP source code.

Returns

string

Implementation of

Pharborist\NodeInterface::getText()
public
# __toString( )
public
# getTree( )

Convert tree into array.

Convert tree into array.

Useful for viewing the tree structure.

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