/** * @return Job|null */ public function invoke() { try { return $this->jobFactory->createFromResponse($this->responseOath->invoke()); } catch (NotFoundException $notFound) { return null; } }
/** * @expectedException \Beanie\Exception\InvalidArgumentException */ public function testCreate_noJobData_throwsInvalidArgumentException() { $response = new Response(Response::RESPONSE_OK, ['id' => self::TEST_ID], $this->getServerMock()); $JobFactory = new JobFactory(); $JobFactory->createFromResponse($response); }
/** * @param CommandInterface $command * @return Job|null * @throws Exception\InvalidArgumentException */ protected function peek(CommandInterface $command) { $this->sync(); return $this->jobFactory->createFromCommand($command, $this->server)->invoke(); }
/** * @return JobOath * @throws Exception\InvalidArgumentException */ public function reserveOath() { return $this->jobFactory->createFromCommand($this->commandFactory->create(CommandInterface::COMMAND_RESERVE), $this->server->transformTubeStatusTo($this->getTubeStatus(), TubeStatus::TRANSFORM_WATCHED)); }
/** * @param int $jobId * @return Job\Job|null * @throws Exception\InvalidArgumentException */ public function peek($jobId) { return $this->jobFactory->createFromCommand($this->commandFactory->create(CommandInterface::COMMAND_PEEK, [$jobId]), $this->server)->invoke(); }