/**
  * @throws AMQPServerException|AMQPServerConnectionException
  * @return integer - the message count in queue
  **/
 public function queueDeclare($name, AMQPQueueConfig $conf)
 {
     $this->checkConnection();
     try {
         $this->queueList[$name] = new AMQPQueue($this->transport->getLink());
         $obj = $this->queueList[$name];
         $result = $obj->declare($name, $conf->getBitmask(new AMQPPeclQueueBitmask()));
     } catch (AMQPQueueException $e) {
         throw new AMQPServerException($e->getMessage(), $e->getCode(), $e);
     }
     $this->checkCommandResult(is_int($result), "Could not declare queue");
     return $result;
 }
 /**
  * @throws AMQPServerException|AMQPServerConnectionException
  * @return integer - the message count in queue
  **/
 public function queueDeclare($name, AMQPQueueConfig $conf)
 {
     $this->checkConnection();
     try {
         if (isset($this->queueList[$name])) {
             unset($this->queueList[$name]);
         }
         $this->queueList[$name] = new AMQPQueue($this->getChannelLink());
         $obj = $this->queueList[$name];
         $obj->setName($name);
         $obj->setFlags($conf->getBitmask(new AMQPPeclQueueBitmask()));
         $obj->setArguments($conf->getArguments());
         $result = $obj->declare();
     } catch (Exception $e) {
         $this->clearConnection();
         throw new AMQPServerException($e->getMessage(), $e->getCode(), $e);
     }
     $this->checkCommandResult(is_int($result), "Could not declare queue");
     return $result;
 }