1 | <?php |
||
29 | class Index implements \JsonSerializable { |
||
30 | |||
31 | const INDEX_OK = 1; |
||
32 | const INDEX_IGNORE = 2; |
||
33 | |||
34 | const INDEX_META = 4; |
||
35 | const INDEX_CONTENT = 8; |
||
36 | const INDEX_FULL = 12; |
||
37 | const INDEX_REMOVE = 16; |
||
38 | |||
39 | const INDEX_DONE = 32; |
||
40 | const INDEX_FAILED = 64; |
||
41 | |||
42 | const ERROR_FAILED = 1; |
||
43 | const ERROR_FAILED2 = 2; |
||
44 | const ERROR_FAILED3 = 4; |
||
45 | |||
46 | const ERROR_SEV_1 = 1; |
||
47 | const ERROR_SEV_2 = 2; |
||
48 | const ERROR_SEV_3 = 3; |
||
49 | const ERROR_SEV_4 = 4; |
||
50 | |||
51 | |||
52 | /** @var string */ |
||
53 | private $providerId; |
||
54 | |||
55 | /** @var string */ |
||
56 | private $documentId; |
||
57 | |||
58 | /** @var string */ |
||
59 | private $source = ''; |
||
60 | |||
61 | /** @var string */ |
||
62 | private $ownerId = ''; |
||
63 | |||
64 | /** @var int */ |
||
65 | private $status = 0; |
||
66 | |||
67 | /** @var array */ |
||
68 | private $options = []; |
||
69 | |||
70 | /** @var int */ |
||
71 | private $err = 0; |
||
72 | |||
73 | /** @var array */ |
||
74 | private $errors = []; |
||
75 | |||
76 | /** @var int */ |
||
77 | private $lastIndex = 0; |
||
78 | |||
79 | |||
80 | /** |
||
81 | * Index constructor. |
||
82 | * |
||
83 | * @param string $providerId |
||
84 | * @param string $documentId |
||
85 | */ |
||
86 | public function __construct($providerId, $documentId) { |
||
90 | |||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getProviderId() { |
||
98 | |||
99 | /** |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getDocumentId() { |
||
105 | |||
106 | |||
107 | /** |
||
108 | * @param string $source |
||
109 | * |
||
110 | * @return $this |
||
111 | */ |
||
112 | public function setSource($source) { |
||
117 | |||
118 | /** |
||
119 | * @return string |
||
120 | */ |
||
121 | public function getSource() { |
||
124 | |||
125 | |||
126 | /** |
||
127 | * @param string $ownerId |
||
128 | * |
||
129 | * @return $this |
||
130 | */ |
||
131 | public function setOwnerId($ownerId) { |
||
136 | |||
137 | /** |
||
138 | * @return string |
||
139 | */ |
||
140 | public function getOwnerId() { |
||
143 | |||
144 | |||
145 | /** |
||
146 | * @param int $status |
||
147 | * @param bool $reset |
||
148 | * |
||
149 | * @return $this |
||
150 | */ |
||
151 | public function setStatus($status, $reset = false) { |
||
160 | |||
161 | /** |
||
162 | * @return int |
||
163 | */ |
||
164 | public function getStatus() { |
||
167 | |||
168 | /** |
||
169 | * @param int $status |
||
170 | * |
||
171 | * @return bool |
||
|
|||
172 | */ |
||
173 | public function isStatus($status) { |
||
176 | |||
177 | /** |
||
178 | * @param int $status |
||
179 | */ |
||
180 | public function unsetStatus($status) { |
||
187 | |||
188 | |||
189 | /** |
||
190 | * @param string $option |
||
191 | * @param string|int $value |
||
192 | * |
||
193 | * @return $this |
||
194 | */ |
||
195 | public function addOption($option, $value) { |
||
200 | |||
201 | /** |
||
202 | * @param string $option |
||
203 | * @param int $value |
||
204 | * |
||
205 | * @return $this |
||
206 | */ |
||
207 | public function addOptionInt($option, $value) { |
||
212 | |||
213 | |||
214 | /** |
||
215 | * @param array $options |
||
216 | * |
||
217 | * @return $this |
||
218 | */ |
||
219 | public function setOptions($options) { |
||
224 | |||
225 | /** |
||
226 | * @return array |
||
227 | */ |
||
228 | public function getOptions() { |
||
231 | |||
232 | |||
233 | /** |
||
234 | * @param string $option |
||
235 | * @param string $default |
||
236 | * |
||
237 | * @return string |
||
238 | */ |
||
239 | public function getOption($option, $default = '') { |
||
246 | |||
247 | |||
248 | |||
249 | /** |
||
250 | * @param string $option |
||
251 | * @param int $default |
||
252 | * |
||
253 | * @return int |
||
254 | */ |
||
255 | public function getOptionInt($option, $default = 0) { |
||
262 | |||
263 | /** |
||
264 | * @param int $err |
||
265 | * |
||
266 | * @return $this |
||
267 | */ |
||
268 | public function setErrorCount($err) { |
||
273 | |||
274 | /** |
||
275 | * @return int |
||
276 | */ |
||
277 | public function getErrorCount() { |
||
280 | |||
281 | /** |
||
282 | * @return array |
||
283 | */ |
||
284 | public function getLastError() { |
||
287 | |||
288 | |||
289 | /** |
||
290 | * |
||
291 | */ |
||
292 | public function resetErrors() { |
||
296 | |||
297 | /** |
||
298 | * @return array |
||
299 | */ |
||
300 | public function getErrors() { |
||
303 | |||
304 | /** |
||
305 | * @param array $messages |
||
306 | * |
||
307 | * @return Index |
||
308 | */ |
||
309 | public function setErrors($messages) { |
||
314 | |||
315 | |||
316 | /** |
||
317 | * @param string $message |
||
318 | * @param string $exception |
||
319 | * @param int $sev |
||
320 | */ |
||
321 | public function addError($message, $exception = '', $sev = self::ERROR_SEV_3) { |
||
330 | |||
331 | |||
332 | /** |
||
333 | * @param int $lastIndex |
||
334 | * |
||
335 | * @return $this |
||
336 | */ |
||
337 | public function setLastIndex($lastIndex = -1) { |
||
346 | |||
347 | /** |
||
348 | * @return int |
||
349 | */ |
||
350 | public function getLastIndex() { |
||
353 | |||
354 | |||
355 | /** |
||
356 | * @return array<string,string|integer> |
||
357 | */ |
||
358 | public function jsonSerialize() { |
||
371 | |||
372 | |||
373 | public function __destruct() { |
||
383 | |||
384 | } |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.