Ids   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 2
b 0
f 0
dl 0
loc 22
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A for() 0 5 1
A current() 0 3 1
A __construct() 0 3 1
A consistingOf() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\Pathfinder\Graph;
4
5
use function array_map;
6
use Stratadox\ImmutableCollection\ImmutableCollection;
7
use Stratadox\Pathfinder\Labels;
8
9
final class Ids extends ImmutableCollection implements Labels
10
{
11
    private function __construct(string ...$labels)
12
    {
13
        parent::__construct(...$labels);
14
    }
15
16
    public static function consistingOf(string ...$labels): Labels
17
    {
18
        return new self(...$labels);
19
    }
20
21
    public static function for(Vertex ...$vertices): Labels
22
    {
23
        return new self(...array_map(function (Vertex $vertex): string {
24
            return $vertex->label();
25
        }, $vertices));
26
    }
27
28
    public function current(): string
29
    {
30
        return parent::current();
31
    }
32
}
33