Passed
Push — master ( a1a5b3...2e461e )
by Tomasz
01:31
created

Uuid   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 6
dl 0
loc 10
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
1
<?php
2
/**
3
 *
4
 * This file is part of the Aggrego.
5
 * (c) Tomasz Kunicki <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 */
11
12
declare(strict_types = 1);
13
14
namespace Aggrego\EventConsumer\Event;
15
16
use Assert\Assertion;
17
use TimiTao\ValueObject\Utils\StringValueObject;
18
19
class Uuid extends StringValueObject
20
{
21
    public function __construct(string $value)
22
    {
23
        Assertion::regex(
24
            $value,
25
            '/^[0-9A-F]{8}-[0-9A-F]{4}-[1-5][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i',
26
            'Incorrect UUID format: ' . $value
27
        );
28
        parent::__construct(self::class, $value);
29
    }
30
}
31