Passed
Push — master ( f6e69a...a01f5a )
by Dawid
02:41
created

AutoGenerateId::getId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
crap 2
1
<?php declare(strict_types=1);
2
3
namespace Igni\Storage\Mapping;
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