Completed
Push — master ( a47a63...7aba9f )
by Nikola
9s
created

forConstraintString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 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
use DomainException;
15
16
/**
17
 * @author Nikola Posa <[email protected]>
18
 */
19
class InvalidConstraintStringException extends DomainException implements Exception
20
{
21 1
    public static function forInvalidType($constraintString)
22
    {
23 1
        return new self(sprintf(
24 1
            'Constraint string should be of type string; %s given',
25 1
            gettype($constraintString)
26 1
        ));
27
    }
28
29 1
    public static function forEmptyCostraintString()
30
    {
31 1
        return new self('Constraint string must not be empty');
32
    }
33
34 4
    public static function forConstraintString($constraintString)
35
    {
36 4
        return new self(sprintf(
37 4
            "Constraint string: '%s' seems to be invalid and it cannot be parsed",
38
            $constraintString
39 4
        ));
40
    }
41
}
42