Road::cost()   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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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