Total Complexity | 5 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
7 | final class Jump implements WeightedMove |
||
8 | { |
||
9 | /** @var string */ |
||
10 | private $target; |
||
11 | /** @var float */ |
||
12 | private $cost; |
||
13 | |||
14 | private function __construct(string $target, float $cost) |
||
15 | { |
||
16 | $this->target = $target; |
||
17 | $this->cost = $cost; |
||
18 | } |
||
19 | |||
20 | public static function to(string $target, float $cost): WeightedMove |
||
21 | { |
||
22 | return new self($target, $cost); |
||
23 | } |
||
24 | |||
25 | public function __toString(): string |
||
26 | { |
||
27 | return 'Go to ' . $this->target; |
||
28 | } |
||
29 | |||
30 | public function target(): string |
||
31 | { |
||
32 | return $this->target; |
||
33 | } |
||
34 | |||
35 | public function cost(): float |
||
38 | } |
||
39 | } |
||
40 |