Square   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 10
c 1
b 0
f 0
dl 0
loc 34
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A label() 0 3 1
A costing() 0 3 1
A labeled() 0 3 1
A price() 0 3 1
A isBlocked() 0 3 1
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