private function createQueues(Configuration $config)
 {
     if (!isset($config['queues'])) {
         return;
     }
     foreach ($config['queues'] as $name => $parameters) {
         $currentWithDl = $config->hasDeadLetterExchange();
         $retries = array();
         $bindings = $parameters['bindings'];
         unset($parameters['bindings']);
         if (isset($parameters['with_dl'])) {
             $currentWithDl = (bool) $parameters['with_dl'];
             unset($parameters['with_dl']);
         }
         if (isset($parameters['retries'])) {
             $retries = $parameters['retries'];
             $currentWithDl = true;
             unset($parameters['retries']);
         }
         if ($currentWithDl && $config->hasDeadLetterExchange() === false) {
             $this->createDl();
         }
         if ($currentWithDl && !isset($config['arguments']['x-dead-letter-exchange'])) {
             if (!isset($parameters['arguments'])) {
                 $parameters['arguments'] = array();
             }
             $parameters['arguments']['x-dead-letter-exchange'] = 'dl';
             $parameters['arguments']['x-dead-letter-routing-key'] = $name;
         }
         $this->createQueue($name, $parameters);
         $withDelay = false;
         if (isset($parameters['delay'])) {
             $withDelay = true;
             $delay = (int) $parameters['delay'];
             $this->createExchange('delay', array('durable' => true));
             $this->createQueue($name . '_delay_' . $delay, array('durable' => true, 'arguments' => array('x-message-ttl' => $delay, 'x-dead-letter-exchange' => 'delay', 'x-dead-letter-routing-key' => $name)));
             $this->createBinding('delay', $name, $name);
             unset($parameters['delay']);
         }
         if ($currentWithDl) {
             $this->createQueue($name . '_dl', array('durable' => true));
             $this->createBinding('dl', $name . '_dl', $name);
         }
         for ($i = 0; $i < count($retries); $i++) {
             $retryName = $name . '_retry_' . ($i + 1);
             $this->createExchange('retry', array('durable' => true, 'type' => 'topic', 'arguments' => array('alternate-exchange' => 'unroutable')));
             $this->createQueue($retryName, array('durable' => true, 'arguments' => array('x-message-ttl' => $retries[$i] * 1000, 'x-dead-letter-exchange' => 'retry', 'x-dead-letter-routing-key' => $name)));
             $this->createBinding('retry', $retryName, $retryName);
             $this->createBinding('retry', $name, $name);
         }
         foreach ($bindings as $binding) {
             if (!is_array($binding) && false !== strpos($binding, ':')) {
                 $parts = explode(':', $binding);
                 $binding = ['exchange' => $parts[0], 'routing_key' => $parts[1]];
             }
             $this->createUserBinding($name, $binding, $withDelay ? $delay : false);
         }
     }
 }