Uuid::guard()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
ccs 5
cts 5
cp 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpValueObjects\Identity;
6
7
use Assert\Assertion;
8
use Exception;
9
use PhpValueObjects\AbstractValueObject;
10
11
abstract class Uuid extends AbstractValueObject
12
{
13 6
    public function __construct(string $value)
14
    {
15 6
        parent::__construct($value);
16 3
    }
17
18 6
    protected function guard($value): void
19
    {
20
        try {
21 6
            Assertion::uuid($value);
22 3
        } catch (Exception $e) {
23 3
            $this->throwException($value);
24
        }
25 3
    }
26
}
27