Completed
Push — master ( 13448b...aac7b1 )
by Alex
02:54
created

ExtensionException::invalidExtension()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
crap 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