FormatterException::needsQuality()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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