Factory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A factory() 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\BasicBlockDomainProfile\Domain\Profile;
15
16
use Aggrego\Domain\Profile\Profile;
17
use Assert\Assertion;
18
use Composer\Semver\VersionParser;
19
20
class Factory
21
{
22
    public const PROFILE_NAME = 'basic_block';
23
24
    public static function factory(string $version): Profile
25
    {
26
        Assertion::regex($version, '~^([0-9]+\.{0,1})+$~');
27
        $normalized = (new VersionParser())->normalize($version);
28
        return Profile::createFromParts(self::PROFILE_NAME, $normalized);
29
    }
30
}
31