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

UUIDV1   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A fromString() 0 3 1
A __construct() 0 3 1
A generate() 0 3 1
A getId() 0 3 1
A getHumanReadableId() 0 3 1
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