Completed
Push — master ( 13448b...aac7b1 )
by Alex
02:54
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 Asmaster\EquipTwig\Exception;
4
5
use Asmaster\EquipTwig\Exception\ExceptionInterface;
6
use InvalidArgumentException;
7
use Twig_ExtensionInterface as TwigExtensionInterface;
8
9
class ExtensionException extends InvalidArgumentException implements ExceptionInterface
10
{
11
    /**
12
     * @param string|object $spec
13
     *
14
     * @return static
15
     */
16 1
    public static function invalidClass($spec)
17
    {
18 1
        if (is_object($spec)) {
19 1
            $spec = get_class($spec);
20
        }
21
22 1
        return new static(sprintf(
23 1
            'Twig extension `%s` must implement `%s`',
24
            $spec,
25 1
            TwigExtensionInterface::class
26
        ));
27
    }
28
}
29