Square::label()   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\Builder;
4
5
final class Square implements Field
6
{
7
    private $label;
8
    private $cost;
9
10
    private function __construct(string $label, float $cost)
11
    {
12
        $this->label = $label;
13
        $this->cost = $cost;
14
    }
15
16
    public static function labeled(string $label): self
17
    {
18
        return new self($label, 1.0);
19
    }
20
21
    public function isBlocked(): bool
22
    {
23
        return false;
24
    }
25
26
    public function label(): string
27
    {
28
        return $this->label;
29
    }
30
31
    public function price(): float
32
    {
33
        return $this->cost;
34
    }
35
36
    public function costing(float $price): Field
37
    {
38
        return new self($this->label, $price);
39
    }
40
}
41