示例#1
0
 /**
  * @return Job|null
  */
 public function invoke()
 {
     try {
         return $this->jobFactory->createFromResponse($this->responseOath->invoke());
     } catch (NotFoundException $notFound) {
         return null;
     }
 }
示例#2
0
 /**
  * @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);
 }
示例#3
0
文件: Tube.php 项目: zwilias/beanie
 /**
  * @param CommandInterface $command
  * @return Job|null
  * @throws Exception\InvalidArgumentException
  */
 protected function peek(CommandInterface $command)
 {
     $this->sync();
     return $this->jobFactory->createFromCommand($command, $this->server)->invoke();
 }
示例#4
0
文件: Worker.php 项目: zwilias/beanie
 /**
  * @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));
 }
示例#5
0
 /**
  * @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();
 }