| Conditions | 8 |
| Paths | 10 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 8 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function process(ContainerBuilder $container) |
||
| 26 | 12 | { |
|
| 27 | 6 | // when no custom exception controller has been set |
|
| 28 | 6 | if ($container->hasDefinition('fos_rest.exception_listener') && |
|
| 29 | 12 | null === $container->getDefinition('fos_rest.exception_listener')->getArgument(0) |
|
| 30 | ) { |
||
| 31 | if (isset($container->getParameter('kernel.bundles')['TwigBundle']) && $container->has('templating.engine.twig')) { |
||
| 32 | // only use this when TwigBundle is enabled and the deprecated SF templating integration is used |
||
| 33 | $controller = Kernel::VERSION_ID >= 40100 ? 'fos_rest.exception.twig_controller::showAction' : 'fos_rest.exception.twig_controller:showAction'; |
||
| 34 | } else { |
||
| 35 | $controller = Kernel::VERSION_ID >= 40100 ? 'fos_rest.exception.controller::showAction' : 'fos_rest.exception.controller:showAction'; |
||
| 36 | } |
||
| 37 | |||
| 38 | $container->getDefinition('fos_rest.exception_listener')->replaceArgument(0, $controller); |
||
| 39 | } |
||
| 40 | |||
| 41 | if (!$container->has('templating.engine.twig')) { |
||
| 42 | $container->removeDefinition('fos_rest.exception.twig_controller'); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 |