Completed
Push — master ( f63aaf...b18312 )
by Alex
05:51
created

ExtensionException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 2
c 5
b 0
f 1
lcom 0
cbo 0
dl 0
loc 20
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A invalidClass() 0 12 2
1
<?php
2
3
namespace AlexMasterov\EquipTwig\Exception;
4
5
use AlexMasterov\EquipTwig\Exception\ExceptionInterface;
6
use InvalidArgumentException;
7
use Twig_ExtensionInterface;
8
9
class ExtensionException extends InvalidArgumentException implements ExceptionInterface
10
{
11
    /**
12
     * @param string|object $spec
13
     *
14
     * @return static
15
     */
16 2
    public static function invalidClass($spec)
17
    {
18 2
        if (is_object($spec)) {
19 2
            $spec = get_class($spec);
20
        }
21
22 2
        return new static(sprintf(
23 2
            'Twig extension `%s` must implement `%s`',
24
            $spec,
25 2
            Twig_ExtensionInterface::class
26
        ));
27
    }
28
}
29