Passed
Pull Request — main (#8)
by Alex
03:11 queued 01:35
created

UUIDV1::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace StraTDeS\VO\Single;
4
5
use Ramsey\Uuid\Uuid;
6
use Ramsey\Uuid\UuidInterface;
7
8
class UUIDV1 extends Id
9
{
10
    private UuidInterface $id;
11
12 3
    private function __construct(UuidInterface $id)
13
    {
14 3
        $this->id = $id;
15 3
    }
16
17 1
    public static function generate(): UUIDV1
18
    {
19 1
        return new static(Uuid::uuid1());
20
    }
21
22 1
    public function getId(): UuidInterface
23
    {
24 1
        return $this->id;
25
    }
26
27 2
    public static function fromString(string $string): UUIDV1
28
    {
29 2
        return new static(Uuid::fromString($string));
30
    }
31
32 1
    public function getHumanReadableId(): string
33
    {
34 1
        return $this->id->toString();
35
    }
36
}
37