/**
  * {@inheritdoc}
  */
 protected function extract(Message $message)
 {
     if (!$message->hasBuckets()) {
         return null;
     }
     return new ArrayIterator($message->buckets);
 }
 /**
  * @return boolean
  */
 protected function isDone()
 {
     if ($this->message === null) {
         return false;
     }
     if ($this->message->hasDone() && $this->message->done) {
         return true;
     }
     return false;
 }
 /**
  * {@inheritdoc}
  */
 protected function extract(Message $message)
 {
     if ($message->hasResults()) {
         return $this->iteratorFromResults($message->results);
     }
     if ($message->hasKeys()) {
         return $this->iteratorFromKeys($message->keys);
     }
     return null;
 }
 /**
  * {@inheritdoc}
  */
 protected function extract(Message $message)
 {
     if (!$message->hasResponse()) {
         return null;
     }
     $phase = $message->hasPhase() ? $message->phase : 0;
     $response = json_decode($message->response, true);
     $entry = new MapReduceEntry();
     $entry->phase = $phase;
     $entry->response = $response;
     return $entry;
 }
Esempio n. 5
0
 protected function _prepareData(\DrSlump\Protobuf\Message $args = null)
 {
     $data = array();
     if ($args !== null) {
         $descriptor = $args->descriptor();
         if ($descriptor->getFieldByName('accounting') !== null) {
             $this->userId = $args->getAccounting()->getUserId();
             $this->transactionId = $args->getAccounting()->getTransactionId();
         }
     }
     $data[] = $this->getRestMethod()->path;
     if (isset($this->userId)) {
         $data[] = $this->userId;
     } else {
         $data[] = "unknownUser";
     }
     if (isset($this->transactionId)) {
         $data[] = $this->transactionId;
     } else {
         $data[] = "unknownTransaction";
     }
     return $data;
 }