Conditions | 5 |
Paths | 5 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
23 | public function from(string $start): array |
||
24 | { |
||
25 | if (!$this->network->has($start)) { |
||
26 | throw NonExistingStart::tried($start); |
||
27 | } |
||
28 | |||
29 | $paths = []; |
||
30 | foreach ($this->network->all() as $goal) { |
||
31 | if ($start !== $goal) { |
||
32 | try { |
||
33 | $paths[$goal] = $this->between($start, $goal); |
||
34 | } catch (NoPathAvailable $unreachableNode) { |
||
35 | // the node is not reachable: simply leave it out. |
||
36 | } |
||
37 | } |
||
38 | } |
||
39 | return $paths; |
||
40 | } |
||
53 |