示例#1
0
 /**
  * @param \Beanie\Command\Response $response
  * @return Job
  * @throws InvalidArgumentException
  */
 public function createFromResponse(Response $response)
 {
     $state = isset(self::$responseToStateMap[$response->getName()]) ? self::$responseToStateMap[$response->getName()] : Job::STATE_UNKNOWN;
     $this->validateResponseData($response->getData());
     return new Job($response->getData()['id'], $response->getData()['data'], $response->getServer(), $state);
 }
示例#2
0
 /**
  * @param string $jobData
  * @param Response $response
  * @return Job
  */
 protected function createJob($jobData, Response $response)
 {
     return new Job($response->getData(), $jobData, $response->getServer(), self::$jobStateMap[$response->getName()]);
 }