Skip to content

Commit

Permalink
Update README file.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Dec 11, 2018
1 parent 1d704b0 commit 238f4e6
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,29 @@ API documentation is automatically generated with [APIGen](https://github.com/Ap
## Usage

```php
use drupol\phptree\Node\ValueNode;
use drupol\phptree\Node\KeyValueNode;
<?php

$tree = new KeyValueNode('root');
declare(strict_types = 1);

$nodes = [];
foreach (\range('a', 'e') as $lowercaseValue) {
$node1 = new ValueNode($lowercaseValue);
use Graphp\GraphViz\GraphViz;
use drupol\phptree\Converter\Graph;
use drupol\phptree\Node\ValueNode;

include './vendor/autoload.php';

foreach (\range('A', 'E') as $uppercaseValue) {
$node2 = new ValueNode($uppercaseValue);
$node1->add($node2);
}
$tree = new ValueNode('root', 2);

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

$tree->add(...$nodes);

$graphViz = new GraphViz();
$graph = new Graph();

$graphViz->display($graph->convert($tree));
```

## Code quality, tests and benchmarks
Expand Down

0 comments on commit 238f4e6

Please sign in to comment.