1 | <?php |
||
17 | class Robot |
||
18 | { |
||
19 | /** |
||
20 | * Purchased by Rupert, then tanked :). |
||
21 | * |
||
22 | * @var SpaceInterface |
||
23 | */ |
||
24 | private $mySpace; |
||
25 | |||
26 | private $placement; |
||
27 | |||
28 | 5 | private function __construct(SpaceInterface $space, Place $placement) |
|
33 | |||
34 | /** |
||
35 | * @param SpaceInterface $space |
||
36 | * @param Place $placement |
||
37 | * |
||
38 | * @return Robot |
||
39 | * |
||
40 | * @throws Assert\AssertionFailedException |
||
41 | */ |
||
42 | 5 | public static function create(SpaceInterface $space, Place $placement): Robot |
|
46 | |||
47 | 2 | public function moveNorthward(): Robot |
|
58 | |||
59 | 1 | public function moveEastward(): Robot |
|
70 | |||
71 | 2 | public function moveSouthward(): Robot |
|
82 | |||
83 | 2 | public function moveWestward(): Robot |
|
94 | |||
95 | 1 | public function getPlacement(): Place |
|
99 | |||
100 | /** |
||
101 | * validateCanMove. |
||
102 | * |
||
103 | * The robot requires a space during construction, however, |
||
104 | * this is extra precautionary in case the space is removed |
||
105 | * |
||
106 | * @throws NotPlacedInSpaceException |
||
107 | */ |
||
108 | 4 | private function validateCanMove(): void |
|
116 | } |
||
117 |