| Conditions | 6 |
| Paths | 5 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | public function process(ContainerBuilder $container) |
||
| 29 | { |
||
| 30 | if (!$container->hasDefinition('runopencode.exchange_rate.notifications.email')) { |
||
| 31 | return; |
||
| 32 | } |
||
| 33 | |||
| 34 | if (!$container->hasParameter('runopencode.exchange_rate.notifications.e_mail')) { |
||
| 35 | $container->removeDefinition('runopencode.exchange_rate.notifications.email'); |
||
| 36 | return; |
||
| 37 | } |
||
| 38 | |||
| 39 | if (!$container->hasDefinition('mailer') || !class_exists('\\Symfony\\Bundle\\SwiftmailerBundle\\SwiftmailerBundle')) { |
||
| 40 | throw new RuntimeException('Bundle "symfony/swiftmailer-bundle" is required for email notifications.'); |
||
| 41 | } |
||
| 42 | |||
| 43 | $recipients = $container->getParameter('runopencode.exchange_rate.notifications.e_mail'); |
||
| 44 | |||
| 45 | if (0 === count($recipients)) { |
||
| 46 | throw new RuntimeException('At least one recipient for e-mail notifications must be provided.'); |
||
| 47 | } |
||
| 48 | |||
| 49 | $container |
||
| 50 | ->getDefinition('runopencode.exchange_rate.notifications.e_mail') |
||
| 51 | ->addArgument($recipients); |
||
| 52 | } |
||
| 53 | } |
||
| 54 |