original_string: public function pop()
      {
          $keys = array_keys($this->queues);
  
          for ($this->queueCounter; isset($keys[$this->queueCounter]); $this->queueCounter++) {
              $queue = $this->queues[$keys[$this->queueCounter]];
  
              $message = $queue->pop();
  
              if ($message !== null) {
                  $this->queueCounter++;
                  $this->processedMessages++;
                  return $message;
              }
  
              // After the last queue has been popped
              if ((count($this->queues) -1) === $this->queueCounter) {
                  $this->queueCounter = 0;
  
                  if ($this->processedMessages === 0) {
                      return null;
                  }
  
                  $this->processedMessages = 0;
              }
          }
  
          return null;
      }
code: public function pop()
      {
          $keys = array_keys($this->queues);
  
          for ($this->queueCounter; isset($keys[$this->queueCounter]); $this->queueCounter++) {
              $queue = $this->queues[$keys[$this->queueCounter]];
  
              $message = $queue->pop();
  
              if ($message !== null) {
                  $this->queueCounter++;
                  $this->processedMessages++;
                  return $message;
              }
  
              // After the last queue has been popped
              if ((count($this->queues) -1) === $this->queueCounter) {
                  $this->queueCounter = 0;
  
                  if ($this->processedMessages === 0) {
                      return null;
                  }
  
                  $this->processedMessages = 0;
              }
          }
  
          return null;
      }
code_tokens: public function pop ( ) { $ keys = array_keys ( $ this -> queues ) ; for ( $ this -> queueCounter ; isset ( $ keys [ $ this -> queueCounter ] ) ; $ this -> queueCounter ++ ) { $ queue = $ this -> queues [ $ keys [ $ this -> queueCounter ] ] ; $ message = $ queue -> pop ( ) ; if ( $ message !== null ) { $ this -> queueCounter ++ ; $ this -> processedMessages ++ ; return $ message ; } // After the last queue has been popped if ( ( count ( $ this -> queues ) - 1 ) === $ this -> queueCounter ) { $ this -> queueCounter = 0 ; if ( $ this -> processedMessages === 0 ) { return null ; } $ this -> processedMessages = 0 ; } } return null ; }
docstring: Returns the next message from each queue until all are empty
  
  @return Message|null
docstring_tokens: Returns the next message from each queue until all are empty