Passed
Pull Request — master (#149)
by Pierre
03:06
created

DictionaryNotFoundException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Knp\DictionaryBundle\Exception;
6
7
use Exception;
8
9
final class DictionaryNotFoundException extends Exception
10
{
11
    /**
12
     * @param string[] $knowns
13
     */
14 3
    public function __construct(string $dictionaryName, array $knowns = [], Exception $previous = null)
15
    {
16 3
        $message = sprintf('The dictionary "%s" has not been found in the registry.', $dictionaryName);
17
18 3
        if (!empty($knowns)) {
19 1
            $message .= sprintf(' Known dictionaries are: "%s".', implode('", "', $knowns));
20
        }
21
22 3
        parent::__construct($message, 0, $previous);
23 3
    }
24
}
25