Completed
Push — master ( 3ebd9f...ed37c4 )
by Woody
02:43
created

ResponderException::invalidClass()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 12
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 Equip\Adr\ResponderInterface;
6
use InvalidArgumentException;
7
8 View Code Duplication
class ResponderException extends InvalidArgumentException
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
            'Responder class `%s` must implement `%s`',
23 1
            $spec,
24
            ResponderInterface::class
25 1
        ));
26
    }
27
}
28