File tree 3 files changed +10
-8
lines changed
spec/drupol/phptree/Exporter
3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -56,21 +56,22 @@ public function it_can_export_to_dot_gv()
56
56
57
57
$ result = <<<EOF
58
58
digraph PHPTreeGraph {
59
-
59
+ // The graph attributes.
60
60
ratio = fill
61
61
node [style="filled"]
62
62
63
+ // The graph nodes.
63
64
" {$ nodes ['root ' ]['hash ' ]}" [label=" {$ nodes ['root ' ]['value ' ]}"]
64
65
" {$ nodes ['child1 ' ]['hash ' ]}" [label=" {$ nodes ['child1 ' ]['value ' ]}"]
65
66
" {$ nodes ['child4 ' ]['hash ' ]}" [label=" {$ nodes ['child4 ' ]['value ' ]}"]
66
67
" {$ nodes ['child2 ' ]['hash ' ]}" [label=" {$ nodes ['child2 ' ]['value ' ]}"]
67
68
" {$ nodes ['child3 ' ]['hash ' ]}" [label=" {$ nodes ['child3 ' ]['value ' ]}"]
68
69
70
+ // The graph edges.
69
71
" {$ nodes ['root ' ]['hash ' ]}" -> " {$ nodes ['child1 ' ]['hash ' ]}";
70
72
" {$ nodes ['child1 ' ]['hash ' ]}" -> " {$ nodes ['child4 ' ]['hash ' ]}";
71
73
" {$ nodes ['root ' ]['hash ' ]}" -> " {$ nodes ['child2 ' ]['hash ' ]}";
72
74
" {$ nodes ['root ' ]['hash ' ]}" -> " {$ nodes ['child3 ' ]['hash ' ]}";
73
-
74
75
}
75
76
EOF ;
76
77
$ this
@@ -81,21 +82,22 @@ public function it_can_export_to_dot_gv()
81
82
82
83
$ result = <<<EOF
83
84
graph PHPTreeGraph {
84
-
85
+ // The graph attributes.
85
86
ratio = fill
86
87
node [style="filled"]
87
88
89
+ // The graph nodes.
88
90
" {$ nodes ['root ' ]['hash ' ]}" [label=" {$ nodes ['root ' ]['value ' ]}"]
89
91
" {$ nodes ['child1 ' ]['hash ' ]}" [label=" {$ nodes ['child1 ' ]['value ' ]}"]
90
92
" {$ nodes ['child4 ' ]['hash ' ]}" [label=" {$ nodes ['child4 ' ]['value ' ]}"]
91
93
" {$ nodes ['child2 ' ]['hash ' ]}" [label=" {$ nodes ['child2 ' ]['value ' ]}"]
92
94
" {$ nodes ['child3 ' ]['hash ' ]}" [label=" {$ nodes ['child3 ' ]['value ' ]}"]
93
95
96
+ // The graph edges.
94
97
" {$ nodes ['root ' ]['hash ' ]}" -- " {$ nodes ['child1 ' ]['hash ' ]}";
95
98
" {$ nodes ['child1 ' ]['hash ' ]}" -- " {$ nodes ['child4 ' ]['hash ' ]}";
96
99
" {$ nodes ['root ' ]['hash ' ]}" -- " {$ nodes ['child2 ' ]['hash ' ]}";
97
100
" {$ nodes ['root ' ]['hash ' ]}" -- " {$ nodes ['child3 ' ]['hash ' ]}";
98
-
99
101
}
100
102
EOF ;
101
103
$ this
Original file line number Diff line number Diff line change @@ -75,9 +75,9 @@ public function export(NodeInterface $node): string
75
75
}
76
76
77
77
return $ this ->getGv (
78
- implode (PHP_EOL , $ attributes ),
79
- implode (PHP_EOL , $ nodes ),
80
- implode (PHP_EOL , $ edges )
78
+ \ implode (PHP_EOL , $ attributes ),
79
+ \ implode (PHP_EOL , $ nodes ),
80
+ \ implode (PHP_EOL , $ edges )
81
81
);
82
82
}
83
83
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class TrieNode extends KeyValueNode
14
14
*/
15
15
public function add (NodeInterface ...$ nodes ): NodeInterface
16
16
{
17
- /** @var \drupol\phptree\Node\ValueNodeInterface $node */
17
+ /** @var \drupol\phptree\Node\KeyValueNodeInterface $node */
18
18
foreach ($ nodes as $ node ) {
19
19
$ data = $ node ->getValue ();
20
20
You can’t perform that action at this time.
0 commit comments