PHP Interface PhpParser\Node

Show file Open project: nikic/php-parser Interface Usage Examples

Public Methods

Method Description
getAttribute ( string $key, mixed $default = null ) : mixed Returns the value of an attribute.
getAttributes ( ) : array Returns all attributes for the given node.
getDocComment ( ) : null | Comment\Doc Gets the doc comment of the node.
getLine ( ) : integer Gets line the node started in.
getSubNodeNames ( ) : array Gets the names of the sub nodes.
getType ( ) : string Gets the type of the node.
hasAttribute ( string $key ) : boolean Returns whether an attribute exists.
setAttribute ( string $key, mixed $value ) Sets an attribute on a node.
setDocComment ( Comment\Doc $docComment ) Sets the doc comment of the node.
setLine ( integer $line ) Sets line the node started in.

Method Details

getAttribute() public method

Returns the value of an attribute.
public getAttribute ( string $key, mixed $default = null ) : mixed
$key string
$default mixed
return mixed

getAttributes() public method

Returns all attributes for the given node.
public getAttributes ( ) : array
return array

getDocComment() public method

The doc comment has to be the last comment associated with the node.
public getDocComment ( ) : null | Comment\Doc
return null | Comment\Doc Doc comment object or null

getLine() public method

Gets line the node started in.
public getLine ( ) : integer
return integer Line

getSubNodeNames() public method

Gets the names of the sub nodes.
public getSubNodeNames ( ) : array
return array Names of sub nodes

getType() public method

Gets the type of the node.
public getType ( ) : string
return string Type of the node

hasAttribute() public method

Returns whether an attribute exists.
public hasAttribute ( string $key ) : boolean
$key string
return boolean

setAttribute() public method

Sets an attribute on a node.
public setAttribute ( string $key, mixed $value )
$key string
$value mixed

setDocComment() public method

This will either replace an existing doc comment or add it to the comments array.
public setDocComment ( Comment\Doc $docComment )
$docComment Comment\Doc Doc comment to set

setLine() public method

Sets line the node started in.
public setLine ( integer $line )
$line integer Line