Passed
Push — master ( a290cb...57bf28 )
by Dawid
02:40
created

AutoGenerateId::getId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Igni\Storage\Id;
4
5
use Igni\Storage\Id;
6
7
/**
8
 * @property Id $id
9
 */
10
trait AutoGenerateId
11
{
12 14
    public function getId(): Id
13
    {
14 14
        if ($this->id === null) {
15 4
            $this->id = new Uuid();
16
        }
17
18 14
        return $this->id;
19
    }
20
}
21