| Total Complexity | 4 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 94.44% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | final class DictionaryBuildingPass implements CompilerPassInterface |
||
| 15 | { |
||
| 16 | public function process(ContainerBuilder $containerBuilder): void |
||
| 17 | 3 | { |
|
| 18 | $configuration = $containerBuilder->getParameter('knp_dictionary.configuration'); |
||
| 19 | 3 | ||
| 20 | if (false === \is_array($configuration)) { |
||
| 21 | 3 | throw new \Exception('The configuration "knp_dictionary.dictionaries" should be an array.'); |
|
| 22 | } |
||
| 23 | |||
| 24 | foreach ($configuration['dictionaries'] as $name => $config) { |
||
| 25 | 3 | $containerBuilder->setDefinition( |
|
| 26 | 3 | \sprintf('knp_dictionary.dictionary.%s', $name), |
|
| 27 | 3 | $this->createDefinition($name, $config) |
|
| 28 | 3 | ); |
|
| 29 | } |
||
| 30 | } |
||
| 31 | 3 | ||
| 32 | /** |
||
| 33 | * @param mixed[] $config |
||
| 34 | */ |
||
| 35 | private function createDefinition(string $name, array $config): Definition |
||
| 51 | 3 | } |
|
| 52 | } |
||
| 53 |