Completed
Push — master ( d76cf7...55ae92 )
by Nikola
02:19
created

InvalidVersionException::forNumber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Version\Exception;
6
7
use DomainException;
8
9
/**
10
 * @author Nikola Posa <[email protected]>
11
 */
12
class InvalidVersionException extends DomainException implements ExceptionInterface
13
{
14 3
    public static function forNumber(string $name, int $value) : self
15
    {
16 3
        return new self(sprintf(
17 3
            '%s version must be non-negative integer, %s given',
18 3
            ucfirst($name),
19 3
            $value
20
        ));
21
    }
22
}
23