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

Interface NodeInterface

Public API for Node.

This interface is used by tagging interfaces such as ExpressionNode to indicate they support the Node API.

Direct known implementers

Pharborist\ExpressionNode, Pharborist\Functions\LexicalVariableNode, Pharborist\Node, Pharborist\ParentNodeInterface, Pharborist\Types\ArrayElementNode, Pharborist\Types\ScalarNode

Indirect known implementers

Pharborist\ArrayLookupNode, Pharborist\BacktickNode, Pharborist\Constants\FileMagicConstantNode, 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\Operators\BooleanNotNode, Pharborist\Operators\BooleanOrNode, Pharborist\Constants\FunctionMagicConstantNode, 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\Operators\FloatCastNode, Pharborist\Operators\GreaterThanNode, Pharborist\Constants\LineMagicConstantNode, 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\Operators\LogicalXorNode, Pharborist\Operators\ModulusAssignNode, Pharborist\Constants\MethodMagicConstantNode, Pharborist\Operators\ModulusNode, Pharborist\Operators\MultiplyAssignNode, Pharborist\Operators\MultiplyNode, Pharborist\Operators\NegateNode, Pharborist\Operators\NotEqualNode, Pharborist\Operators\NotIdenticalNode, Pharborist\Operators\ObjectCastNode, Pharborist\Operators\PlusNode, Pharborist\Operators\PostDecrementNode, Pharborist\Operators\PostIncrementNode, Pharborist\Constants\NamespaceMagicConstantNode, 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\Operators\SuppressWarningNode, Pharborist\Operators\TernaryOperationNode, Pharborist\Constants\TraitMagicConstantNode, Pharborist\Operators\UnaryOperationNode, Pharborist\Operators\UnsetCastNode, Pharborist\ParenthesisNode, Pharborist\ParentNode, Pharborist\PartialCommentNode, Pharborist\PartialNode, Pharborist\RootNode, Pharborist\SplatNode, Pharborist\StatementBlockNode, Pharborist\StatementNode, Pharborist\ControlStructures\BreakStatementNode, Pharborist\TemplateNode, Pharborist\TokenNode, Pharborist\Types\ArrayNode, Pharborist\Types\ArrayPairNode, Pharborist\Types\BooleanNode, Pharborist\Types\FalseNode, Pharborist\Types\FloatNode, Pharborist\Types\HeredocNode, Pharborist\Types\IntegerNode, Pharborist\Types\InterpolatedStringNode, Pharborist\ControlStructures\CaseNode, Pharborist\Types\NullNode, Pharborist\Types\StringNode, Pharborist\Types\StringVariableNode, Pharborist\Types\TrueNode, Pharborist\UnsetStatementNode, Pharborist\Variables\CompoundVariableNode, Pharborist\Variables\GlobalStatementNode, Pharborist\Variables\ReferenceVariableNode, Pharborist\Variables\StaticVariableNode, Pharborist\Variables\StaticVariableStatementNode, Pharborist\ControlStructures\ContinueStatementNode, Pharborist\Variables\VariableExpressionNode, Pharborist\Variables\VariableNode, Pharborist\Variables\VariableVariableNode, Pharborist\WhitespaceNode, Pharborist\ControlStructures\DeclareDirectiveNode, Pharborist\BlankStatementNode, Pharborist\ControlStructures\DeclareNode, Pharborist\ControlStructures\DefaultNode, Pharborist\ControlStructures\DoWhileNode, Pharborist\ControlStructures\ElseIfNode, Pharborist\ControlStructures\ExitNode, Pharborist\ControlStructures\ForeachNode, Pharborist\ControlStructures\ForNode, Pharborist\ControlStructures\GotoLabelNode, Pharborist\ControlStructures\GotoStatementNode, Pharborist\ControlStructures\IfNode, Pharborist\CommaListNode, Pharborist\ControlStructures\ImportNode, Pharborist\ControlStructures\IncludeNode, Pharborist\ControlStructures\IncludeOnceNode, Pharborist\ControlStructures\RequireNode, Pharborist\ControlStructures\RequireOnceNode, Pharborist\ControlStructures\ReturnStatementNode, Pharborist\ControlStructures\SwitchNode, Pharborist\ControlStructures\WhileNode, Pharborist\DocCommentNode, Pharborist\EchoStatementNode, Pharborist\CommentNode, Pharborist\EchoTagStatementNode, Pharborist\Exceptions\CatchNode, Pharborist\Exceptions\ThrowStatementNode, Pharborist\Exceptions\TryCatchNode, Pharborist\ExpressionStatementNode, Pharborist\Functions\AnonymousFunctionNode, Pharborist\Functions\CallbackCallNode, Pharborist\Functions\CallNode, Pharborist\Functions\DefineNode, Pharborist\Functions\EmptyNode, Pharborist\Constants\ClassMagicConstantNode, Pharborist\Functions\EvalNode, Pharborist\Functions\FunctionCallNode, Pharborist\Functions\FunctionDeclarationNode, Pharborist\Functions\HaltCompilerNode, Pharborist\Functions\IssetNode, Pharborist\Functions\ListNode, Pharborist\Functions\ParameterNode, Pharborist\Functions\UnsetNode, Pharborist\Generators\YieldNode, Pharborist\Generators\YieldStatementNode, Pharborist\Constants\ConstantDeclarationNode, Pharborist\LineCommentBlockNode, Pharborist\Namespaces\NameNode, Pharborist\Namespaces\NamespaceNode, Pharborist\Namespaces\UseDeclarationBlockNode, Pharborist\Namespaces\UseDeclarationNode, Pharborist\Namespaces\UseDeclarationStatementNode, Pharborist\Objects\ClassConstantLookupNode, Pharborist\Objects\ClassMemberListNode, Pharborist\Objects\ClassMemberLookupNode, Pharborist\Objects\ClassMemberNode, Pharborist\Constants\ConstantDeclarationStatementNode, Pharborist\Objects\ClassMethodCallNode, Pharborist\Objects\ClassMethodNode, Pharborist\Objects\ClassNameScalarNode, Pharborist\Objects\ClassNode, Pharborist\Objects\ClassStatementNode, Pharborist\Objects\InterfaceMethodNode, Pharborist\Objects\InterfaceNode, Pharborist\Objects\InterfaceStatementNode, Pharborist\Objects\NameExpressionNode, Pharborist\Objects\NewNode, Pharborist\Constants\ConstantNode, Pharborist\Objects\ObjectMethodCallNode, Pharborist\Objects\ObjectPropertyNode, Pharborist\Objects\SingleInheritanceNode, Pharborist\Objects\TraitAdaptationStatementNode, Pharborist\Objects\TraitAliasNode, Pharborist\Objects\TraitMethodReferenceNode, Pharborist\Objects\TraitNode, Pharborist\Objects\TraitPrecedenceNode, Pharborist\Objects\TraitUseNode, Pharborist\Operators\AddAssignNode, Pharborist\Constants\DirMagicConstantNode, Pharborist\Operators\AddNode, Pharborist\Operators\ArrayCastNode, Pharborist\Operators\AssignNode, Pharborist\Operators\AssignReferenceNode, Pharborist\Operators\BinaryOperationNode, Pharborist\Operators\BitwiseAndAssignNode, Pharborist\Operators\BitwiseAndNode, Pharborist\Operators\BitwiseNotNode, Pharborist\Operators\BitwiseOrAssignNode, Pharborist\Operators\BitwiseOrNode
Namespace: Pharborist
Located at NodeInterface.php
Methods summary
public Pharborist\SourcePosition
# getSourcePosition( )

Get the source position of the node.

Get the source position of the node.

Returns

Pharborist\SourcePosition
public string
# getText( )

Convert the node into PHP source code.

Convert the node into PHP source code.

Returns

string
public Pharborist\ParentNode
# parent( callable $callback = NULL )

Get the parent node.

Get the parent node.

Parameters

$callback
An optional callback to filter by.

Returns

Pharborist\ParentNode
public Pharborist\NodeCollection
# parents( callable $callback = NULL )

Get the ancestors of this node.

Get the ancestors of this node.

Parameters

$callback
An optional callback to filter by.

Returns

Pharborist\NodeCollection
public Pharborist\NodeCollection
# parentsUntil( callable $callback, boolean $inclusive = FALSE )

Get ancestors up to the node matched by callback.

Get ancestors up to the node matched by callback.

Parameters

$callback
Callback to test for match.
$inclusive
TRUE to include the node matched by callback.

Returns

Pharborist\NodeCollection
public Pharborist\Node
# closest( callable $callback )

Get the first node matched by the callback by testing this node and traversing up through its ancestors in the tree.

Get the first node matched by the callback by testing this node and traversing up through its ancestors in the tree.

Parameters

$callback
Callback to test for match.

Returns

Pharborist\Node
public Pharborist\Node
# furthest( callable $callback )

Get the last node matched by the callback by testing this node and traversing up through its ancestors in the tree.

Get the last node matched by the callback by testing this node and traversing up through its ancestors in the tree.

Parameters

$callback
Callback to test for match.

Returns

Pharborist\Node
public integer
# index( )

Get the position of the element relative to its sibling elements.

Get the position of the element relative to its sibling elements.

Returns

integer
public Pharborist\Node
# previous( callable $callback = NULL )

Get the previous sibling.

Get the previous sibling.

Parameters

$callback
An optional callback to filter by.

Returns

Pharborist\Node
public Pharborist\NodeCollection
# previousAll( callable $callback = NULL )

Get the previous siblings of this node.

Get the previous siblings of this node.

Parameters

$callback
An optional callback to filter by.

Returns

Pharborist\NodeCollection
public Pharborist\NodeCollection
# previousUntil( callable $callback, boolean $inclusive = FALSE )

Get all the preceding siblings up to but not including the match.

Get all the preceding siblings up to but not including the match.

Parameters

$callback
Callback to test for match.
$inclusive
TRUE to include the node matched by callback.

Returns

Pharborist\NodeCollection
public Pharborist\Node
# next( callable $callback = NULL )

Get the next immediate sibling.

Get the next immediate sibling.

Parameters

$callback
An optional callback to filter by.

Returns

Pharborist\Node
public Pharborist\NodeCollection
# nextAll( callable $callback = NULL )

Get all the following siblings.

Get all the following siblings.

Parameters

$callback
An optional callback to filter by.

Returns

Pharborist\NodeCollection
public Pharborist\NodeCollection
# nextUntil( callable $callback, boolean $inclusive = FALSE )

Get all the following siblings up to but not including the match.

Get all the following siblings up to but not including the match.

Parameters

$callback
Callback to test for match.
$inclusive
TRUE to include the node matched by callback.

Returns

Pharborist\NodeCollection
public Pharborist\NodeCollection
# siblings( callable $callback = NULL )

Get the siblings.

Get the siblings.

Parameters

$callback
An optional callback to filter by.

Returns

Pharborist\NodeCollection
public
# insertBefore( Pharborist\Node|Pharborist\Node[]|Pharborist\NodeCollection $targets )

Insert this node before targets.

Insert this node before targets.

Parameters

$targets
Nodes to insert before.

Returns


$this
public
# before( Pharborist\Node|Pharborist\Node[]|Pharborist\NodeCollection $nodes )

Insert nodes before this node.

Insert nodes before this node.

Parameters

$nodes
Nodes to insert.

Returns


$this
public
# insertAfter( Pharborist\Node|Pharborist\Node[]|Pharborist\NodeCollection $targets )

Insert this node after targets.

Insert this node after targets.

Parameters

$targets
Nodes to insert after.

Returns


$this
public
# after( Pharborist\Node|Pharborist\Node[]|Pharborist\NodeCollection $nodes )

Insert nodes after this node.

Insert nodes after this node.

Parameters

$nodes
Nodes to insert.

Returns


$this
public
# remove( )

Remove this node from its parent.

Remove this node from its parent.

Returns


$this
public
# replaceWith( Pharborist\Node|Pharborist\Node[]|Pharborist\NodeCollection|callable $node )

Replace this node with another node.

Replace this node with another node.

Parameters

$node
Replacement node.

Returns


$this
public
# swapWith( Pharborist\Node $node )

Swap this node with another.

Swap this node with another.

Parameters

$node
Node to swap with.

Returns


$this
public
# replaceAll( Pharborist\Node|Pharborist\Node[]|Pharborist\NodeCollection $targets )

Replace nodes with this node.

Replace nodes with this node.

Parameters

$targets
Nodes to replace.

Returns


$this
public
# prependTo( Pharborist\ParentNode|Pharborist\ParentNode[]|Pharborist\NodeCollection $targets )

Prepend this node to target.

Prepend this node to target.

Parameters

$targets
Targets to prepend to.

Returns


$this
public
# appendTo( Pharborist\ParentNode|Pharborist\ParentNode[]|Pharborist\NodeCollection $targets )

Append this node to target.

Append this node to target.

Parameters

$targets
Targets to append to.

Returns


$this
public Pharborist\RootNode|null
# getRoot( )

Returns the root node if this node belongs to one.

Returns the root node if this node belongs to one.

Returns

Pharborist\RootNode|null
public
# hasRoot( )

Returns TRUE if this node belongs to a root node.

Returns TRUE if this node belongs to a root node.

Pharborist API documentation generated by ApiGen