Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function execute(Board $board, string $alias, array $operation) |
||
18 | { |
||
19 | $distance = 0; |
||
20 | list($x, $y) = $board->getActorPosition($alias); |
||
21 | $direction = $board->getActorDirection($alias); |
||
22 | list($diffX, $diffY) = static::$moveMap[$direction]; |
||
|
|||
23 | while ('ground' === $board->getField($x + $diffX, $y + $diffY)) { |
||
24 | $board->debug('Scan Field[%s:%s] Field[%s:%s] Type[%s]', |
||
25 | $y, $x, $y + $diffY, $x + $diffX, |
||
26 | $board->getField($x + $diffX, $y + $diffY)); |
||
27 | $x += $diffX; |
||
28 | $y += $diffY; |
||
29 | $distance++; |
||
30 | } |
||
31 | $board->setVariable($operation['variable'], $distance); |
||
32 | $board->debug('Scan Distance[%s] Variable[%s]', $distance, $operation['variable']); |
||
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.