Identifier::getValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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