| Conditions | 5 |
| Paths | 5 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 8 | public function process(ContainerBuilder $container) |
|
| 17 | { |
||
| 18 | 8 | if (false === $container->hasParameter('liip_monitor.mailer.enabled')) { |
|
| 19 | 1 | return; |
|
| 20 | } |
||
| 21 | |||
| 22 | 7 | if (false === $container->getParameter('liip_monitor.mailer.enabled')) { |
|
| 23 | 1 | return; |
|
| 24 | } |
||
| 25 | |||
| 26 | try { |
||
| 27 | 6 | $definition = $container->findDefinition('mailer'); |
|
| 28 | 2 | } catch (ServiceNotFoundException $e) { |
|
| 29 | 2 | throw new \InvalidArgumentException('To enable mail reporting you have to install the "swiftmailer/swiftmailer" or "symfony/mailer".'); |
|
| 30 | } |
||
| 31 | |||
| 32 | 4 | $filename = \Swift_Mailer::class !== $definition->getClass() ? 'symfony_mailer.xml' : 'swift_mailer.xml'; |
|
| 33 | |||
| 34 | 4 | $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../../Resources/config')); |
|
| 35 | 4 | $loader->load($filename); |
|
| 36 | 4 | } |
|
| 37 | } |
||
| 38 |