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 | public function __construct($providerId, $documentId) { |
||
84 | |||
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getProviderId() { |
||
92 | |||
93 | /** |
||
94 | * @return string |
||
95 | */ |
||
96 | public function getDocumentId() { |
||
99 | |||
100 | |||
101 | /** |
||
102 | * @param string $source |
||
103 | * |
||
104 | * @return $this |
||
105 | */ |
||
106 | public function setSource($source) { |
||
111 | |||
112 | /** |
||
113 | * @return string |
||
114 | */ |
||
115 | public function getSource() { |
||
118 | |||
119 | |||
120 | /** |
||
121 | * @param string $ownerId |
||
122 | * |
||
123 | * @return $this |
||
124 | */ |
||
125 | public function setOwnerId($ownerId) { |
||
130 | |||
131 | /** |
||
132 | * @return string |
||
133 | */ |
||
134 | public function getOwnerId() { |
||
137 | |||
138 | |||
139 | /** |
||
140 | * @param int $status |
||
141 | * @param bool $reset |
||
142 | * |
||
143 | * @return $this |
||
144 | */ |
||
145 | public function setStatus($status, $reset = false) { |
||
154 | |||
155 | /** |
||
156 | * @return int |
||
157 | */ |
||
158 | public function getStatus() { |
||
161 | |||
162 | /** |
||
163 | * @param int $status |
||
164 | * |
||
165 | * @return bool |
||
|
|||
166 | */ |
||
167 | public function isStatus($status) { |
||
170 | |||
171 | /** |
||
172 | * @param int $status |
||
173 | */ |
||
174 | public function unsetStatus($status) { |
||
181 | |||
182 | |||
183 | /** |
||
184 | * @param string $option |
||
185 | * @param string|int $value |
||
186 | * |
||
187 | * @return $this |
||
188 | */ |
||
189 | public function addOption($option, $value) { |
||
194 | |||
195 | /** |
||
196 | * @param array $options |
||
197 | * |
||
198 | * @return $this |
||
199 | */ |
||
200 | public function setOptions($options) { |
||
205 | |||
206 | /** |
||
207 | * @return array |
||
208 | */ |
||
209 | public function getOptions() { |
||
212 | |||
213 | |||
214 | /** |
||
215 | * @param string $option |
||
216 | * @param string $default |
||
217 | * |
||
218 | * @return mixed|string |
||
219 | */ |
||
220 | public function getOption($option, $default = '') { |
||
227 | |||
228 | |||
229 | /** |
||
230 | * @param int $err |
||
231 | * |
||
232 | * @return $this |
||
233 | */ |
||
234 | public function setErrorCount($err) { |
||
239 | |||
240 | /** |
||
241 | * @return int |
||
242 | */ |
||
243 | public function getErrorCount() { |
||
246 | |||
247 | /** |
||
248 | * @return array |
||
249 | */ |
||
250 | public function getLastError() { |
||
253 | |||
254 | |||
255 | /** |
||
256 | * |
||
257 | */ |
||
258 | public function resetErrors() { |
||
262 | |||
263 | /** |
||
264 | * @return array |
||
265 | */ |
||
266 | public function getErrors() { |
||
269 | |||
270 | /** |
||
271 | * @param array $messages |
||
272 | * |
||
273 | * @return Index |
||
274 | */ |
||
275 | public function setErrors($messages) { |
||
280 | |||
281 | |||
282 | /** |
||
283 | * @param string $message |
||
284 | * @param string $exception |
||
285 | * @param int $sev |
||
286 | */ |
||
287 | public function addError($message, $exception = '', $sev = self::ERROR_SEV_3) { |
||
296 | |||
297 | |||
298 | /** |
||
299 | * @param int $lastIndex |
||
300 | * |
||
301 | * @return $this |
||
302 | */ |
||
303 | public function setLastIndex($lastIndex = -1) { |
||
312 | |||
313 | /** |
||
314 | * @return int |
||
315 | */ |
||
316 | public function getLastIndex() { |
||
319 | |||
320 | |||
321 | /** |
||
322 | * @return array<string,string|integer> |
||
323 | */ |
||
324 | public function jsonSerialize() { |
||
337 | |||
338 | |||
339 | public function __destruct() { |
||
349 | |||
350 | } |
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.