Completed
Push — master ( 79e89c...34165e )
by Nikola
01:13
created

InvalidVersionString   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 18
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A notParsable() 0 7 1
A getVersionString() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Version\Exception;
6
7
use DomainException;
8
9
class InvalidVersionString extends DomainException implements VersionException
10
{
11
    /** @var string */
12
    protected $versionString;
13
14 5
    public static function notParsable(string $versionString): self
15
    {
16 5
        $exception = new self(sprintf("Version string '%s' is not valid and cannot be parsed", $versionString));
17 5
        $exception->versionString = $versionString;
18
19 5
        return $exception;
20
    }
21
22 3
    public function getVersionString(): string
23
    {
24 3
        return $this->versionString;
25
    }
26
}
27