Completed
Push — master ( 759854...e46a01 )
by Martin
13:10 queued 03:41
created

LevelIsNotDefinedException::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
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
    public static function create($level, array $levels)
21
    {
22
        $message = sprintf(
23
          'Level "%s" is not defined, use one of: "%s"',
24
          $level,
25
          implode('", "', array_keys($levels))
26
        );
27
28
        return new static($message);
29
    }
30
}
31