vendor/uvdesk/mailbox-component/DependencyInjection/UVDeskExtension.php line 17

Open in your IDE?
  1. <?php
  2. namespace Webkul\UVDesk\MailboxBundle\DependencyInjection;
  3. use Symfony\Component\Config\FileLocator;
  4. use Symfony\Component\DependencyInjection\ContainerBuilder;
  5. use Symfony\Component\HttpKernel\DependencyInjection\Extension;
  6. use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  7. class UVDeskExtension extends Extension
  8. {
  9. public function getAlias()
  10. {
  11. return 'uvdesk_mailbox';
  12. }
  13. public function getConfiguration(array $configs, ContainerBuilder $container)
  14. {
  15. return new Configuration();
  16. }
  17. public function load(array $configs, ContainerBuilder $container)
  18. {
  19. $services = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/services'));
  20. $services->load('services.yaml');
  21. // Register automations conditionally if AutomationBundle has been added as an dependency.
  22. if (array_key_exists('UVDeskAutomationBundle', $container->getParameter('kernel.bundles'))) {
  23. $services->load('automations.yaml');
  24. }
  25. // Load bundle configurations
  26. $configuration = $this->getConfiguration($configs, $container);
  27. foreach ($this->processConfiguration($configuration, $configs) as $param => $value) {
  28. switch ($param) {
  29. case 'emails':
  30. foreach ($value as $field => $fieldValue) {
  31. $container->setParameter("uvdesk.emails.$field", $fieldValue);
  32. }
  33. break;
  34. case 'mailboxes':
  35. $container->setParameter("uvdesk.mailboxes", array_keys($value));
  36. foreach ($value as $mailboxId => $mailboxDetails) {
  37. $mailboxDetails['email'] = $mailboxDetails['imap_server']['username'];
  38. $container->setParameter("uvdesk.mailboxes.$mailboxId", $mailboxDetails);
  39. }
  40. break;
  41. default:
  42. break;
  43. }
  44. }
  45. }
  46. }