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

InvalidVersionStringException::getVersionString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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