Passed
Push — master ( b97c16...98e719 )
by Dawid
04:21
created

AutoGenerateId::getId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 7
ccs 3
cts 4
cp 0.75
crap 2.0625
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 10
    public function getId(): Id
13
    {
14 10
        if ($this->id === null) {
15
            $this->id = new Uuid();
16
        }
17
18 10
        return $this->id;
19
    }
20
}
21