Jump   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A cost() 0 3 1
A to() 0 3 1
A __toString() 0 3 1
A target() 0 3 1
A __construct() 0 4 1
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