/** * @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); }
/** * @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()]); }