Passed
Push — master ( 8786d7...e2cb6e )
by Tomasz
01:31
created

Version   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 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\QueryConsumer;
15
16
use Assert\Assertion;
17
use Composer\Semver\VersionParser;
18
use TimiTao\ValueObject\Utils\StringValueObject;
19
20
class Version extends StringValueObject
21
{
22
    public function __construct(string $value)
23
    {
24
        Assertion::regex($value, '~^([0-9]+\.{0,1})+$~');
25
        $normalized = (new VersionParser())->normalize($value);
26
        parent::__construct(self::class, $normalized);
27
    }
28
}
29