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 $configsContainerBuilder $container)
  14.     {
  15.         return new Configuration();
  16.     }
  17.     public function load(array $configsContainerBuilder $container)
  18.     {
  19.         $services = new YamlFileLoader($container, new FileLocator(__DIR__ '/../Resources/config/services'));
  20.         
  21.         $services->load('services.yaml');
  22.         
  23.         // Register automations conditionally if AutomationBundle has been added as an dependency.
  24.         if (array_key_exists('UVDeskAutomationBundle'$container->getParameter('kernel.bundles'))) {
  25.             $services->load('automations.yaml');
  26.         }
  27.         
  28.         // Load bundle configurations
  29.         $configuration $this->getConfiguration($configs$container);
  30.         foreach ($this->processConfiguration($configuration$configs) as $param => $value) {
  31.             switch ($param) {
  32.                 case 'emails':
  33.                     foreach ($value as $field => $fieldValue) {
  34.                         $container->setParameter("uvdesk.emails.$field"$fieldValue);
  35.                     }
  36.                     break;
  37.                 case 'mailboxes':
  38.                     $container->setParameter("uvdesk.mailboxes"array_keys($value));
  39.                     foreach ($value as $mailboxId => $mailboxDetails) {
  40.                         $mailboxDetails['email'] = $mailboxDetails['imap_server']['username'];
  41.                         
  42.                         $container->setParameter("uvdesk.mailboxes.$mailboxId"$mailboxDetails);
  43.                     }
  44.                     break;
  45.                 default:
  46.                     break;
  47.             }
  48.         }
  49.     }
  50. }