1 | <?php |
||
14 | class JobFactory implements FactoryInterface |
||
15 | { |
||
16 | use FactoryTrait; |
||
17 | |||
18 | private static $responseToStateMap = [ |
||
19 | Response::RESPONSE_RESERVED => Job::STATE_RESERVED, |
||
20 | Response::RESPONSE_INSERTED => Job::STATE_RELEASED, |
||
21 | Response::RESPONSE_RELEASED => Job::STATE_RELEASED, |
||
22 | Response::RESPONSE_BURIED => Job::STATE_BURIED |
||
23 | ]; |
||
24 | |||
25 | /** |
||
26 | * @param \Beanie\Command\Response $response |
||
27 | * @return Job |
||
28 | * @throws InvalidArgumentException |
||
29 | */ |
||
30 | 14 | public function createFromResponse(Response $response) |
|
40 | |||
41 | /** |
||
42 | * @param CommandInterface $command |
||
43 | * @param Server $server |
||
44 | * @return JobOath |
||
45 | */ |
||
46 | 12 | public function createFromCommand(CommandInterface $command, Server $server) |
|
53 | |||
54 | /** |
||
55 | * @param array $data |
||
56 | * @throws InvalidArgumentException |
||
57 | */ |
||
58 | 14 | protected function validateResponseData(array $data) |
|
67 | } |
||
68 |