Road   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 24
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A cost() 0 3 1
A target() 0 3 1
A towards() 0 3 1
A __construct() 0 4 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\Pathfinder\Graph;
4
5
final class Road implements Edge
6
{
7
    private $target;
8
    private $cost;
9
10
    private function __construct(string $target, float $cost)
11
    {
12
        $this->target = $target;
13
        $this->cost = $cost;
14
    }
15
16
    public static function towards(string $target, float $cost): Edge
17
    {
18
        return new self($target, $cost);
19
    }
20
21
    public function target(): string
22
    {
23
        return $this->target;
24
    }
25
26
    public function cost(): float
27
    {
28
        return $this->cost;
29
    }
30
}
31