File tree 1 file changed +14
-8
lines changed
1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -26,19 +26,25 @@ API documentation is automatically generated with [APIGen](https://github.com/Ap
26
26
27
27
## Usage
28
28
29
- The object has to be used just like a regular array.
30
-
31
29
``` php
32
- $tree = new drupol\phptree\Merkle();
30
+ use drupol\phptree\Node\ValueNode;
31
+ use drupol\phptree\Node\KeyValueNode;
32
+
33
+ $tree = new KeyValueNode('root');
33
34
34
- $tree[] = 'hello';
35
- $tree[] = 'world';
35
+ $nodes = [];
36
+ foreach (\range('a', 'e') as $lowercaseValue) {
37
+ $node1 = new ValueNode($lowercaseValue);
36
38
37
- $tree->hash(); // this returns: b9187808075710ab9c447c6ff6fd2aeb6c4bc10cf752e849102b87c0ecf97824
39
+ foreach (\range('A', 'E') as $uppercaseValue) {
40
+ $node2 = new ValueNode($uppercaseValue);
41
+ $node1->add($node2);
42
+ }
38
43
39
- $tree['key'] = 'value';
44
+ $nodes[] = $node1;
45
+ }
40
46
41
- $tree['key']; // this returns: 'value' ;
47
+ $tree->add(...$nodes) ;
42
48
```
43
49
44
50
## Code quality, tests and benchmarks
You can’t perform that action at this time.
0 commit comments