Completed
Push — master ( cb1787...b96903 )
by Nikola
02:02
created

InvalidVersionStringException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forVersionString() 0 7 1
A getVersionString() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of the Version package.
5
 *
6
 * Copyright (c) Nikola Posa <[email protected]>
7
 *
8
 * For full copyright and license information, please refer to the LICENSE file,
9
 * located at the package root folder.
10
 */
11
12
namespace Version\Exception;
13
14
/**
15
 * @author Nikola Posa <[email protected]>
16
 */
17
class InvalidVersionStringException extends \DomainException implements Exception
18
{
19
    /**
20
     * @var string
21
     */
22
    protected $versionString;
23
24 9
    public static function forVersionString($versionString)
25
    {
26 9
        $exception = new self(sprintf("Version string '%s' is not valid and cannot be parsed", $versionString));
27 9
        $exception->versionString = $versionString;
28
29 9
        return $exception;
30
    }
31
32
    public function getVersionString()
33
    {
34
        return $this->versionString;
35
    }
36
}
37