1 | <?php |
||
19 | class Robot |
||
20 | { |
||
21 | /** |
||
22 | * Purchased by Rupert, then tanked :). |
||
23 | * |
||
24 | * @var SpaceInterface |
||
25 | */ |
||
26 | private $mySpace; |
||
27 | |||
28 | private $position; |
||
29 | |||
30 | private $facingDirection; |
||
31 | |||
32 | 8 | private function __construct( |
|
41 | |||
42 | /** |
||
43 | * @param SpaceInterface $space |
||
44 | * @param Vector $position |
||
45 | * @param string|null $facingDirection |
||
46 | * |
||
47 | * @return Robot |
||
48 | * |
||
49 | * @throws Assert\AssertionFailedException |
||
50 | */ |
||
51 | 9 | public static function create( |
|
62 | |||
63 | public function move(): Robot |
||
74 | |||
75 | public function left(): Robot |
||
81 | |||
82 | public function right(): Robot |
||
88 | |||
89 | 2 | public function moveNorthward(): Robot |
|
100 | |||
101 | 1 | public function moveEastward(): Robot |
|
112 | |||
113 | 2 | public function moveSouthward(): Robot |
|
124 | |||
125 | 2 | public function moveWestward(): Robot |
|
136 | |||
137 | 1 | public function getPosition(): Vector |
|
141 | |||
142 | /** |
||
143 | * validateCanMove. |
||
144 | * |
||
145 | * The robot requires a space during construction, however, |
||
146 | * this is extra precautionary in case the space is removed |
||
147 | * |
||
148 | * @throws NotPlacedInSpaceException |
||
149 | */ |
||
150 | 4 | private function validateCanMove(): void |
|
158 | } |
||
159 |