diff --git a/src/DependencyInjection/BoekkooiAMQPExtension.php b/src/DependencyInjection/BoekkooiAMQPExtension.php index 7770df8..b578a3d 100644 --- a/src/DependencyInjection/BoekkooiAMQPExtension.php +++ b/src/DependencyInjection/BoekkooiAMQPExtension.php @@ -189,16 +189,7 @@ private function configureCommands(ContainerBuilder $container, array $config) } $class = ltrim($class, '\\'); - $commands[$class] = [ - 'vhost' => $info['vhost'], - 'exchange' => $info['exchange'], - 'routing_key' => (isset($info['routing_key']) ? $info['routing_key'] : null), - 'flags' => ( - (isset($info['mandatory']) && $info['mandatory'] ? AMQP_MANDATORY : AMQP_NOPARAM) | - (isset($info['immediate']) && $info['immediate'] ? AMQP_IMMEDIATE : AMQP_NOPARAM) - ), - 'attributes' => (isset($info['attributes']) ? $info['attributes'] : []) - ]; + $commands[$class] = $this->retrieveCommandInformation($info); } $def = $container->getDefinition('boekkooi.amqp.tactician.transformer'); @@ -208,6 +199,20 @@ private function configureCommands(ContainerBuilder $container, array $config) $def->addMethodCall('addSupportedCommands', [array_keys($commands)]); } + private function retrieveCommandInformation(array $info) + { + return [ + 'vhost' => $info['vhost'], + 'exchange' => $info['exchange'], + 'routing_key' => (isset($info['routing_key']) ? $info['routing_key'] : null), + 'flags' => ( + (isset($info['mandatory']) && $info['mandatory'] ? AMQP_MANDATORY : AMQP_NOPARAM) | + (isset($info['immediate']) && $info['immediate'] ? AMQP_IMMEDIATE : AMQP_NOPARAM) + ), + 'attributes' => (isset($info['attributes']) ? $info['attributes'] : []) + ]; + } + private function configureMiddleware(ContainerBuilder $container, array $config) { $commandTransformer = new Reference($config['envelope_transformer']);