Conditions | 5 |
Paths | 3 |
Total Lines | 28 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function drawGraphCycle(array $nodes) |
||
26 | { |
||
27 | if (\count($nodes) < 2) { |
||
28 | throw new RuntimeException('Not enough nodes to draw a cycle'); |
||
29 | } |
||
30 | |||
31 | $firstNode = \array_shift($nodes); |
||
32 | $lastNode = \array_pop($nodes); |
||
33 | |||
34 | $this->drawNode($firstNode); |
||
35 | |||
36 | if (!empty($nodes)) { |
||
37 | $this->drawLine('↑↘'); |
||
38 | $i = 0; |
||
39 | foreach ($nodes as $node) { |
||
40 | if ($i++) { |
||
41 | $this->drawLine('↑ ↓'); |
||
42 | } |
||
43 | $this->drawLine('↑', false); |
||
44 | $this->drawNode($node); |
||
45 | } |
||
46 | $this->drawLine('↑↙'); |
||
47 | } else { |
||
48 | $this->drawLine('↕'); |
||
49 | } |
||
50 | |||
51 | $this->drawNode($lastNode); |
||
52 | } |
||
53 | |||
78 |