| Total Complexity | 9 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class ConfigPass implements CompilerPassInterface |
||
| 9 | { |
||
| 10 | public function process(ContainerBuilder $container) |
||
| 11 | { |
||
| 12 | $parameters = []; |
||
| 13 | $this->buildParameters('friendly', $parameters, $container->getParameter('friendly.parameters')); |
||
| 14 | |||
| 15 | foreach ($parameters as $key => $value) { |
||
| 16 | $container->setParameter($key, $value); |
||
| 17 | } |
||
| 18 | } |
||
| 19 | |||
| 20 | protected function buildParameters($name, &$parameters, $config) |
||
| 21 | { |
||
| 22 | foreach ($config as $key => $element) { |
||
| 23 | if (is_array($element) && $this->arrayHasStringKeys($element)) { |
||
| 24 | $this->buildParameters(sprintf('%s.%s', $name, $key), $parameters, $element); |
||
| 25 | } |
||
| 26 | $parameters[sprintf('%s.%s', $name, $key)] = $element; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | protected function arrayHasStringKeys(array $array) |
||
| 40 | } |
||
| 41 | } |
||
| 42 |