Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ A Control-Flow-Graph implementation in Pure PHP.
## Usage

To bootstrap the parser, you need to give it a `PhpParser` instance:

$parser = new PHPCfg\Parser(
new PhpParser\Parser(new PhpParser\Lexer)
);

```php
$parser = new PHPCfg\Parser(
new PhpParser\Parser(new PhpParser\Lexer)
);
```
Then, just call parse on a block of code, giving it a filename:

$block = $parser->parse(file_get_contents(__FILE__), __FILE__);

```php
$block = $parser->parse(file_get_contents(__FILE__), __FILE__);
```
To dump the graph, simply use the built-in dumper:

$dumper = new PHPCfg\Dumper;
echo $dumper->dump($block);
```php
$dumper = new PHPCfg\Dumper;
echo $dumper->dump($block);
```