PHP Interface PDepend\Source\AST\ASTNode

Since: 2.3
Mostra file Open project: pdepend/pdepend Interface Usage Examples

Public Methods

Method Description
configureLinesAndColumns ( integer $startLine, integer $endLine, integer $startColumn, integer $endColumn ) : void For better performance we have moved the single setter methods for the node columns and lines into this configure method.
findChildrenOfType ( string $targetType, array &$results = [] ) : PDepend\Source\AST\ASTNode[] This method will search recursive for all child nodes that are an instance of the given $targetType. The returned value will be an empty array if no child exists for that.
getChild ( integer $index ) : PDepend\Source\AST\ASTNode Returns the node instance for the given index or throws an exception.
getChildren ( ) : PDepend\Source\AST\ASTNode[] This method returns all direct children of the actual node.
getComment ( ) : string Returns a doc comment for this node or null when no comment was found.
getEndColumn ( ) : integer Returns the end column for this ast node.
getEndLine ( ) : integer Returns the end line for this ast node.
getFirstChildOfType ( string $targetType ) : PDepend\Source\AST\ASTNode This method will search recursive for the first child node that is an instance of the given $targetType. The returned value will be null if no child exists for that.
getImage ( ) : string Returns the source image of this ast node.
getParent ( ) : PDepend\Source\AST\ASTNode Returns the parent node of this node or null when this node is the root of a node tree.
getParentsOfType ( string $parentType ) : PDepend\Source\AST\ASTNode[] Traverses up the node tree and finds all parent nodes that are instances of $parentType.
getStartColumn ( ) : integer Returns the start column for this ast node.
getStartLine ( ) : integer Returns the start line for this ast node.
setComment ( string $comment ) : void Sets the raw doc comment for this node.
setParent ( PDepend\Source\AST\ASTNode $node ) : void Sets the parent node of this node.

Method Details

configureLinesAndColumns() public method

For better performance we have moved the single setter methods for the node columns and lines into this configure method.
Since: 0.9.10
public configureLinesAndColumns ( integer $startLine, integer $endLine, integer $startColumn, integer $endColumn ) : void
$startLine integer
$endLine integer
$startColumn integer
$endColumn integer
return void

findChildrenOfType() public method

This method will search recursive for all child nodes that are an instance of the given $targetType. The returned value will be an empty array if no child exists for that.
public findChildrenOfType ( string $targetType, array &$results = [] ) : PDepend\Source\AST\ASTNode[]
$targetType string Searched class or interface type.
$results array
return PDepend\Source\AST\ASTNode[]

getChild() public method

Returns the node instance for the given index or throws an exception.
public getChild ( integer $index ) : PDepend\Source\AST\ASTNode
$index integer
return PDepend\Source\AST\ASTNode

getChildren() public method

This method returns all direct children of the actual node.
public getChildren ( ) : PDepend\Source\AST\ASTNode[]
return PDepend\Source\AST\ASTNode[]

getComment() public method

Returns a doc comment for this node or null when no comment was found.
public getComment ( ) : string
return string

getEndColumn() public method

Returns the end column for this ast node.
public getEndColumn ( ) : integer
return integer

getEndLine() public method

Returns the end line for this ast node.
public getEndLine ( ) : integer
return integer

getFirstChildOfType() public method

This method will search recursive for the first child node that is an instance of the given $targetType. The returned value will be null if no child exists for that.
public getFirstChildOfType ( string $targetType ) : PDepend\Source\AST\ASTNode
$targetType string
return PDepend\Source\AST\ASTNode

getImage() public method

Returns the source image of this ast node.
public getImage ( ) : string
return string

getParent() public method

Returns the parent node of this node or null when this node is the root of a node tree.
public getParent ( ) : PDepend\Source\AST\ASTNode
return PDepend\Source\AST\ASTNode

getParentsOfType() public method

Traverses up the node tree and finds all parent nodes that are instances of $parentType.
public getParentsOfType ( string $parentType ) : PDepend\Source\AST\ASTNode[]
$parentType string
return PDepend\Source\AST\ASTNode[]

getStartColumn() public method

Returns the start column for this ast node.
public getStartColumn ( ) : integer
return integer

getStartLine() public method

Returns the start line for this ast node.
public getStartLine ( ) : integer
return integer

setComment() public method

Sets the raw doc comment for this node.
public setComment ( string $comment ) : void
$comment string The doc comment block for this node.
return void

setParent() public method

Sets the parent node of this node.
public setParent ( PDepend\Source\AST\ASTNode $node ) : void
$node PDepend\Source\AST\ASTNode
return void