Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
7 | public function retrace( |
||
8 | string $start, |
||
9 | string $goal, |
||
10 | array $breadcrumbs |
||
11 | ): array { |
||
12 | $node = $goal; |
||
13 | $path = []; |
||
14 | while (isset($breadcrumbs[$node])) { |
||
15 | $path[] = $node; |
||
16 | $node = $breadcrumbs[$node]; |
||
17 | } |
||
18 | $path[] = $start; |
||
19 | return array_reverse($path); |
||
20 | } |
||
22 |