| Total Complexity | 8 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class SequencePrinter |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @param Graph $graph |
||
| 9 | * @param Coordinate[] $sequence |
||
| 10 | */ |
||
| 11 | 3 | public function __construct(private Graph $graph, private iterable $sequence) |
|
| 12 | { |
||
| 13 | 3 | } |
|
| 14 | |||
| 15 | 3 | public function printSequence(): void |
|
| 16 | { |
||
| 17 | 3 | $coordinatesAsString = []; |
|
| 18 | |||
| 19 | 3 | foreach ($this->sequence as $coordinate) { |
|
| 20 | 2 | $coordinatesAsString[] = $this->getCoordinateAsString($coordinate); |
|
| 21 | } |
||
| 22 | |||
| 23 | 3 | if (!empty($coordinatesAsString)) { |
|
| 24 | 2 | echo implode(' => ', $coordinatesAsString); |
|
| 25 | 2 | echo "\n"; |
|
| 26 | } |
||
| 27 | |||
| 28 | 3 | echo 'Total cost: ' . $this->getTotalDistance(); |
|
| 29 | 3 | } |
|
| 30 | |||
| 31 | 2 | private function getCoordinateAsString(Coordinate $coordinate): string |
|
| 34 | } |
||
| 35 | |||
| 36 | 3 | private function getTotalDistance(): float | int |
|
| 54 | } |
||
| 55 | } |
||
| 56 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.