FormatterException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidClass() 0 8 1
A needsQuality() 0 7 1
1
<?php
2
3
namespace Equip\Exception;
4
5
use Equip\Formatter\FormatterInterface;
6
use InvalidArgumentException;
7
8
class FormatterException extends InvalidArgumentException
9
{
10
    /**
11
     * @param string $spec
12
     *
13
     * @return static
14
     */
15 1
    public static function invalidClass($spec)
16
    {
17 1
        return new static(sprintf(
18 1
            'Formatter class `%s` must implement `%s`',
19 1
            $spec,
20
            FormatterInterface::class
21 1
        ));
22
    }
23
24
    /**
25
      * @param string $formatter
26
      *
27
      * @return static
28
      */
29 1
     public static function needsQuality($formatter)
30
     {
31 1
         return new static(sprintf(
32 1
             'No quality have been set for the `%s` formatter',
33
             $formatter
34 1
         ));
35
     }
36
}
37