/**
  * {@inheritdoc}
  */
 public function pop()
 {
     if (!($item = $this->pheanstalk->reserveFromTube($this->tubeName, 0))) {
         throw new NoItemAvailableException($this);
     }
     $this->pheanstalk->delete($item);
     return $item->getData();
 }
 /**
  * {@inheritdoc}
  */
 public function dequeue($queueName)
 {
     $job = null;
     try {
         $job = $this->conn->reserveFromTube($queueName, $this->options['reserve-timeout']);
     } catch (\Pheanstalk\Exception $e) {
         throw PheanstalkError::fromException($e);
     }
     return $job ? new PheanstalkEnvelope($job, $this->unserialize($job->getData())) : null;
 }
 /**
  * Wait and get job from a queue
  *
  * @access public
  * @return Job|null
  */
 public function pull()
 {
     $beanstalkJob = $this->beanstalk->reserveFromTube($this->queueName);
     if ($beanstalkJob === false) {
         return null;
     }
     $job = new Job();
     $job->setId($beanstalkJob->getId());
     $job->unserialize($beanstalkJob->getData());
     return $job;
 }
 /**
  * {@inheritDoc}
  */
 public function reserveFromTube($tube, $timeout = null)
 {
     if ($this->dispatcher) {
         $this->dispatcher->dispatch(CommandEvent::RESERVE, new CommandEvent($this, ['tube' => $tube, 'timeout' => $timeout]));
     }
     return $this->pheanstalk->reserveFromTube($tube, $timeout);
 }
 /**
  * {@inheritdoc}
  */
 public function pop($queue, $timeout = 0)
 {
     $job = $this->pheanstalk->reserveFromTube($queue, $timeout);
     if ($job instanceof PheanstalkJob) {
         return new $this->managerClass($queue, $job, $this);
     }
     throw new QueueEmptyException($queue);
 }