1 | <?php |
||
13 | class Job implements \JsonSerializable |
||
14 | { |
||
15 | const STATE_UNKNOWN = null; |
||
16 | const STATE_RELEASED = 'RELEASED'; |
||
17 | const STATE_RESERVED = 'RESERVED'; |
||
18 | const STATE_BURIED = 'BURIED'; |
||
19 | const STATE_DELETED = 'DELETED'; |
||
20 | |||
21 | /** @var int */ |
||
22 | protected $id; |
||
23 | |||
24 | /** @var mixed */ |
||
25 | protected $data; |
||
26 | |||
27 | /** @var Server */ |
||
28 | protected $server; |
||
29 | |||
30 | /** @var null|string */ |
||
31 | protected $state; |
||
32 | |||
33 | /** @var CommandFactory */ |
||
34 | protected $commandFactory; |
||
35 | |||
36 | /** |
||
37 | * @param int $id |
||
38 | * @param mixed $data |
||
39 | * @param Server $server |
||
40 | * @param null|string $state |
||
41 | */ |
||
42 | 31 | public function __construct($id, $data, Server $server, $state = self::STATE_UNKNOWN) |
|
50 | |||
51 | /** |
||
52 | * @return null|string |
||
53 | */ |
||
54 | 26 | public function getState() |
|
58 | |||
59 | /** |
||
60 | * @return int |
||
61 | */ |
||
62 | 17 | public function getId() |
|
66 | |||
67 | /** |
||
68 | * @return mixed |
||
69 | */ |
||
70 | 17 | public function getData() |
|
74 | |||
75 | /** |
||
76 | * @return $this |
||
77 | */ |
||
78 | 1 | public function kick() |
|
83 | |||
84 | /** |
||
85 | * @param int $priority |
||
86 | * @param int $delay |
||
87 | * @return $this |
||
88 | */ |
||
89 | 6 | public function release($priority = Beanie::DEFAULT_PRIORITY, $delay = Beanie::DEFAULT_DELAY) |
|
98 | |||
99 | /** |
||
100 | * @return $this |
||
101 | */ |
||
102 | 1 | public function touch() |
|
107 | |||
108 | /** |
||
109 | * @param int $priority |
||
110 | * @return $this |
||
111 | */ |
||
112 | 2 | public function bury($priority = Beanie::DEFAULT_PRIORITY) |
|
118 | |||
119 | /** |
||
120 | * @return $this |
||
121 | */ |
||
122 | 1 | public function delete() |
|
128 | |||
129 | /** |
||
130 | * @return array |
||
131 | */ |
||
132 | 1 | public function stats() |
|
136 | |||
137 | /** |
||
138 | * @param string $command |
||
139 | * @param array $arguments |
||
140 | * @return Response |
||
141 | */ |
||
142 | 12 | private function executeCommand($command, $arguments = []) |
|
148 | |||
149 | /** |
||
150 | * @return array |
||
151 | */ |
||
152 | 1 | public function jsonSerialize() |
|
160 | } |
||
161 |