PHP Class PhpParser\NodeDumper

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

Public Methods

Method Description
__construct ( array $options = [] ) Constructs a NodeDumper.
dump ( array | phpparser\Node $node, string | null $code = null ) : string Dumps a node or array.

Protected Methods

Method Description
dumpFlags ( $flags )
dumpIncludeType ( $type )
dumpPosition ( phpparser\Node $node )
dumpRecursive ( $node )
dumpUseType ( $type )

Private Methods

Method Description
toColumn ( $code, $pos ) Copied from Error class

Method Details

__construct() public method

Supported options: * bool dumpComments: Whether comments should be dumped. * bool dumpPositions: Whether line/offset information should be dumped. To dump offset information, the code needs to be passed to dump().
public __construct ( array $options = [] )
$options array Options (see description)

dump() public method

Dumps a node or array.
public dump ( array | phpparser\Node $node, string | null $code = null ) : string
$node array | phpparser\Node Node or array to dump
$code string | null Code corresponding to dumped AST. This only needs to be passed if the dumpPositions option is enabled and the dumping of node offsets is desired.
return string Dumped value

dumpFlags() protected method

protected dumpFlags ( $flags )

dumpIncludeType() protected method

protected dumpIncludeType ( $type )

dumpPosition() protected method

protected dumpPosition ( phpparser\Node $node )
$node phpparser\Node

dumpRecursive() protected method

protected dumpRecursive ( $node )

dumpUseType() protected method

protected dumpUseType ( $type )