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

LevelIsNotDefinedException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 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
    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