Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function execute(Board $board, string $alias, array $operation) |
||
18 | { |
||
19 | $direction = $board->getActorDirection($alias); |
||
20 | list($x, $y) = $board->getActorPosition($alias); |
||
21 | $newX = $x + static::$moveMap[$direction][0]; |
||
|
|||
22 | $newY = $y + static::$moveMap[$direction][1]; |
||
23 | |||
24 | if('up' === $operation['direction']) { |
||
25 | $board->debug('Pick[up]'); |
||
26 | $board->setField($newX, $newY, 'ground'); |
||
27 | $board->setActorPick($alias, 'brick'); |
||
28 | } elseif('down' === $operation['direction']) { |
||
29 | $board->debug('Pick[down]'); |
||
30 | $board->setField($newX, $newY, 'brick'); |
||
31 | $board->setActorPick($alias, null); |
||
32 | } |
||
33 | } |
||
34 | |||
45 |
Late static binding only has effect in subclasses. A
final
class cannot be extended anymore so late static binding cannot occurr. Consider replacingstatic::
withself::
.To learn more about late static binding, please refer to the PHP core documentation.