Total Complexity | 6 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class ConfigurationException extends Exception |
||
12 | { |
||
13 | /** |
||
14 | * @var array |
||
15 | */ |
||
16 | private $configuration; |
||
17 | |||
18 | public function __construct( |
||
19 | string $type = null, |
||
20 | string $typeName = '', |
||
21 | $code = 0, |
||
22 | Throwable $previous = null, |
||
23 | array $configuration = [] |
||
24 | ) { |
||
25 | $typeMessage = 'An error has occurred when resolving a configuration'; |
||
26 | |||
27 | if ('menu' === $type) { |
||
28 | $typeMessage = 'An error has occurred when resolving the configuration for the menu "%s"'; |
||
29 | } |
||
30 | |||
31 | if ('action' === $type) { |
||
32 | $typeMessage = 'An error has occurred when resolving the configuration of the action "%s"'; |
||
33 | } |
||
34 | |||
35 | if ('admin' === $type) { |
||
36 | $typeMessage = 'An error has occurred when resolving the configuration of the admin "%s"'; |
||
37 | } |
||
38 | $message = sprintf($typeMessage, $typeName); |
||
39 | |||
40 | if ($previous) { |
||
41 | $message .= ' : '.$previous->getMessage(); |
||
42 | } |
||
43 | |||
44 | parent::__construct($message, $code, $previous); |
||
45 | $this->configuration = $configuration; |
||
46 | } |
||
47 | |||
48 | public function getConfiguration(): array |
||
51 | } |
||
52 | } |
||
53 |