/**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     if (!$this->integrationExtension->isNotifierEnabled()) {
         if (count($container->findTaggedServiceIds('notifier.sender.strategy')) > 0) {
             throw new \RuntimeException('Could not compile notifier sender strategy, because system is not enabled.');
         }
         return;
     }
     $strategyManagerDefinition = $container->findDefinition('notifier.sender_strategy_manager');
     foreach ($container->findTaggedServiceIds('notifier.sender.strategy') as $id => $tags) {
         $definition = $container->getDefinition($id);
         $class = $definition->getClass();
         try {
             $class = $container->getParameterBag()->resolveValue($class);
             $refClass = new \ReflectionClass($class);
             $requiredInterface = 'FivePercent\\Component\\Notifier\\SenderStrategy\\SenderStrategyInterface';
             if (!$refClass->implementsInterface($requiredInterface)) {
                 throw new \RuntimeException(sprintf('The notifier sender strategy should implement "%s" interface.', $requiredInterface));
             }
             foreach ($tags as $index => $attributes) {
                 if (empty($attributes['key'])) {
                     throw new \RuntimeException(sprintf('The "key" parameter for tag with index "%d" must be a specified.', $index));
                 }
                 $strategyManagerDefinition->addMethodCall('addStrategy', [$attributes['key'], new Reference($id)]);
             }
         } catch (\Exception $e) {
             throw new \RuntimeException(sprintf('Could not compile notifier sender strategy with service id "%s".', $id), 0, $e);
         }
     }
 }
 /**
  * {@inheritDoc}
  */
 public function process(ContainerBuilder $container)
 {
     if (!$this->integrationExtension->isNotifierEnabled() || !$this->integrationExtension->isNotifierReplaceSfEventDispatcher()) {
         return;
     }
     $dispatcherServiceId = 'event_dispatcher';
     while ($container->hasAlias($dispatcherServiceId)) {
         $dispatcherServiceId = $container->getAlias($dispatcherServiceId);
     }
     $dispatcherDefinition = $container->getDefinition($dispatcherServiceId);
     $dispatcherDefinition->setPublic(false);
     $container->removeDefinition($dispatcherServiceId);
     $container->setDefinition('event_dispatcher.symfony', $dispatcherDefinition);
     $notifierDispatcherDefinition = $container->getDefinition('event_dispatcher.notifier_proxy');
     $notifierDispatcherDefinition->replaceArgument(0, new Reference('event_dispatcher.symfony'));
     $notifierDispatcherDefinition->replaceArgument(2, $this->integrationExtension->getNotifierEventNamesForDisableNotification());
     $notifierDispatcherDefinition->setAbstract(false);
     $container->setAlias('event_dispatcher', 'event_dispatcher.notifier_proxy');
 }