1 | <?php |
||
17 | abstract class AbstractSymmetricSpace implements SpaceInterface |
||
18 | { |
||
19 | private $dimensions; |
||
20 | |||
21 | private $boundarySize; |
||
22 | |||
23 | private $boundaryCondition; |
||
24 | |||
25 | /** |
||
26 | * @param int $dimensions |
||
27 | * @param int $boundarySize |
||
28 | */ |
||
29 | 15 | protected function __construct(int $dimensions, int $boundarySize) |
|
35 | |||
36 | /** |
||
37 | * @return Vector |
||
38 | */ |
||
39 | 9 | protected function defaultPosition(): Vector |
|
40 | { |
||
41 | // Create a default position [0,0,..n] |
||
|
|||
42 | 9 | return new Vector(array_fill(0, $this->dimensions, 0)); |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param Vector $position |
||
47 | * |
||
48 | * @return Robot |
||
49 | */ |
||
50 | 8 | public function placeRobot(?Vector $position = null): Robot |
|
59 | |||
60 | /** |
||
61 | * @param Vector $place |
||
62 | * |
||
63 | * @return bool |
||
64 | * |
||
65 | * @throws \Reith\ToyRobot\Domain\Space\Exception\BoundaryTestException |
||
66 | */ |
||
67 | 8 | public function isAGoodPosition(Vector $position): bool |
|
83 | |||
84 | /** |
||
85 | * @param Vector $from |
||
86 | * @param Vector|null $to If not supplied, origin is $from |
||
87 | * |
||
88 | * @throws PlaceDimensionsDoNotMatchSpaceException |
||
89 | * @throws \Reith\ToyRobot\Domain\Space\Exception\BoundaryTestException |
||
90 | */ |
||
91 | 7 | public function move(Vector $from, ?Vector $to = null): Vector |
|
110 | |||
111 | /** |
||
112 | * For all the places passed, ensure they are of the same |
||
113 | * dimensionality. |
||
114 | * |
||
115 | * @param Vector $vectors ... Vectors to check |
||
116 | * |
||
117 | * @throws PlaceDimensionsDoNotMatchSpaceException |
||
118 | */ |
||
119 | 7 | private function validateDimensionality(Vector ...$vectors): void |
|
141 | } |
||
142 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.