Skip to content

Commit

Permalink
Update README code example.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Sep 4, 2019
1 parent 63a4e73 commit 966b1ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Blog post: [https://not-a-number.io/2018/phptree-a-fast-tree-implementation](htt
declare(strict_types = 1);

use drupol\phptree\Exporter\Gv;
use drupol\phptree\Exporter\GvConvert;
use drupol\phptree\Exporter\Image;
use drupol\phptree\Node\ValueNode;
use drupol\phptree\Exporter\Text;
use drupol\launcher\Launcher;
Expand All @@ -77,7 +77,7 @@ $tree = new ValueNode('root', 2);

$nodes = [];
foreach (\range('A', 'Z') as $v) {
$nodes[] = new ValueNode($v);
$nodes[] = new ValueNode($v, 2);
}

// Add children to the root node.
Expand All @@ -93,8 +93,8 @@ $dotScript = $exporter->export($tree);
file_put_contents('graph.gv', $dotScript);
// Then do "dot -Tsvg graph.gv -o graph.svg" to export the script to SVG.

// Or use GvConvert() that does it for you.
$exporter = new GvConvert();
// Or use the image converter that does it for you.
$exporter = new Image();
$imagePath = $exporter->setFormat('png')->export($tree);

// If you want to launch the image, you can use an optional package.
Expand Down

0 comments on commit 966b1ee

Please sign in to comment.