Identifier   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
dl 0
loc 33
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 2
A __toString() 0 3 1
A getValue() 0 3 1
1
<?php
2
3
namespace JobQueue\Domain\Task;
4
5
use Ramsey\Uuid\Uuid;
6
7
final class Identifier
8
{
9
    /**
10
     *
11
     * @var string
12
     */
13
    private $value;
14
15
    /**
16
     *
17
     * @param string|null $value
18
     */
19 31
    public function __construct(string $value = null)
20
    {
21 31
        $this->value = $value ?: (string) Uuid::uuid4();
22 31
    }
23
24
    /**
25
     *
26
     * @return string
27
     */
28
    public function getValue(): string
29
    {
30
        return $this->value;
31
    }
32
33
    /**
34
     *
35
     * @return string
36
     */
37 22
    public function __toString(): string
38
    {
39 22
        return $this->value;
40
    }
41
}
42