Jump::target()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\PuzzleSolver\Puzzle\NetworkNavigation;
4
5
use Stratadox\PuzzleSolver\WeightedMove;
6
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
36
    {
37
        return $this->cost;
38
    }
39
}
40