LevelIsNotDefinedException::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Yep\WorkflowLogger\Exception;
4
5
use Psr\Log\InvalidArgumentException;
6
7
/**
8
 * Class LevelIsNotDefinedException
9
 *
10
 * @package Yep\WorkflowLogger\Exception
11
 * @author  Martin Zeman (Zemistr) <[email protected]>
12
 */
13
class LevelIsNotDefinedException extends InvalidArgumentException implements ExceptionInterface
14
{
15
    /**
16
     * @param string $level
17
     * @param array  $levels
18
     * @return static
19
     */
20 3
    public static function create($level, array $levels)
21
    {
22 3
        $message = sprintf(
23 3
          'Level "%s" is not defined, use one of: "%s"',
24 3
          $level,
25 3
          implode('", "', array_keys($levels))
26
        );
27
28 3
        return new static($message);
29
    }
30
}
31