Test Failed
Pull Request — master (#4)
by Miguel Ángel
04:40
created

UuidValueObject   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A guard() 0 6 2
1
<?php
2
3
namespace PhpValueObjects\Scalar;
4
5
use PhpValueObjects\AbstractValueObject;
6
use PhpValueObjects\Scalar\Exception\InvalidUuidException;
7
use Ramsey\Uuid\Uuid;
8
9
class UuidValueObject extends AbstractValueObject
10
{
11
    /**
12
     * @param string $value
13
     *
14
     * @throws InvalidUuidException
15
     */
16
    protected function guard($value)
17
    {
18
        if (!Uuid::isValid($value)) {
19
            throw new InvalidUuidException($value);
20
        }
21
    }
22
}
23