Completed
Push — master ( 5a9455...2006d8 )
by Woody
03:01
created

ConfigurationException::invalidClass()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0625

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 12
ccs 6
cts 8
cp 0.75
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
crap 2.0625
1
<?php
2
3
namespace Equip\Exception;
4
5
use DomainException;
6
use Equip\Configuration\ConfigurationInterface;
7
8
class ConfigurationException extends DomainException
9
{
10
    /**
11
     * @param string|object $spec
12
     *
13
     * @return static
14
     */
15 1
    public static function invalidClass($spec)
16
    {
17 1
        if (is_object($spec)) {
18
            $spec = get_class($spec);
19
        }
20
21 1
        return new static(sprintf(
22 1
            'Configuration class `%s` must implement `%s`',
23 1
            $spec,
24
            ConfigurationInterface::class
25 1
        ));
26
    }
27
}
28