DictionaryNotFoundException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 9
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Knp\DictionaryBundle\Exception;
6
7
final class DictionaryNotFoundException extends \Exception
8
{
9
    /**
10
     * @param string[] $knowns
11
     */
12
    public function __construct(string $dictionaryName, array $knowns = [], ?\Exception $exception = null)
13
    {
14 3
        $message = \sprintf('The dictionary "%s" has not been found in the registry.', $dictionaryName);
15
16 3
        if ([] !== $knowns) {
17
            $message .= \sprintf(' Known dictionaries are: "%s".', implode('", "', $knowns));
18 3
        }
19 1
20
        parent::__construct($message, 0, $exception);
21
    }
22
}
23