Ids::consistingOf()   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 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