1 | <?php |
||
12 | class Payload implements PayloadContract, ArrayAccess, JsonSerializable, Jsonable, Arrayable |
||
13 | { |
||
14 | /** @var int */ |
||
15 | private $status; |
||
16 | |||
17 | /** @var mixed */ |
||
18 | private $output; |
||
19 | |||
20 | /** @var array */ |
||
21 | private $messages = []; |
||
22 | |||
23 | /** @var string|null */ |
||
24 | private $outputWrapper = null; |
||
25 | |||
26 | /** @var string */ |
||
27 | private $messagesWrapper = 'messages'; |
||
28 | |||
29 | /** |
||
30 | * Initialize a Payload object. |
||
31 | */ |
||
32 | public static function instance(): PayloadContract |
||
36 | |||
37 | /** |
||
38 | * Set the Payload status. |
||
39 | * |
||
40 | * @param int $status |
||
41 | */ |
||
42 | public function setStatus(int $status): PayloadContract |
||
49 | |||
50 | /** |
||
51 | * Get the status of the payload. |
||
52 | */ |
||
53 | public function getStatus(): int |
||
57 | |||
58 | /** |
||
59 | * Set the Payload messages. |
||
60 | * |
||
61 | * @param array $output |
||
|
|||
62 | */ |
||
63 | public function setMessages(array $messages): PayloadContract |
||
70 | |||
71 | /** |
||
72 | * Get messages array from the payload. |
||
73 | */ |
||
74 | public function getMessages(): array |
||
78 | |||
79 | /** |
||
80 | * Set the Payload output. |
||
81 | * |
||
82 | * @param mixed $output |
||
83 | * @param string|null $wrapper |
||
84 | */ |
||
85 | public function setOutput($output, ? string $wrapper = null): PayloadContract |
||
96 | |||
97 | /** |
||
98 | * Get the Payload output. |
||
99 | */ |
||
100 | public function getOutput(): array |
||
104 | |||
105 | /** |
||
106 | * Get the raw Payload output. |
||
107 | * |
||
108 | * @return mixed |
||
109 | */ |
||
110 | public function getRawOutput() |
||
114 | |||
115 | /** |
||
116 | * Retrieve the Payload output and wrap it. |
||
117 | * Use the outputWrapper if it is set, otherwise use 'data'. |
||
118 | */ |
||
119 | public function getwrappedOutput(): array |
||
123 | |||
124 | /** |
||
125 | * Get the wrapper for the output. |
||
126 | */ |
||
127 | public function getOutputWrapper(): string |
||
131 | |||
132 | /** |
||
133 | * Get the wrapper for the messages. |
||
134 | */ |
||
135 | public function getMessagesWrapper(): string |
||
139 | |||
140 | /** |
||
141 | * Return all of the components of the payload in array format. |
||
142 | */ |
||
143 | public function all(): array |
||
155 | |||
156 | /** |
||
157 | * Convert the Payload output to an array. |
||
158 | */ |
||
159 | public function getArrayableItems(): array |
||
175 | |||
176 | /** |
||
177 | * Dynamically retrieve attributes on the OutputItem. |
||
178 | * |
||
179 | * @param string $key |
||
180 | * |
||
181 | * @return mixed |
||
182 | */ |
||
183 | public function __get($key) |
||
187 | |||
188 | /** |
||
189 | * Convert the Payload instance to JSON. |
||
190 | * |
||
191 | * @param int $options |
||
192 | * |
||
193 | * @return string |
||
194 | */ |
||
195 | public function toJson($options = 0) |
||
199 | |||
200 | /** |
||
201 | * Convert the Payload into something JSON serializable. |
||
202 | * |
||
203 | * @return array |
||
204 | */ |
||
205 | public function jsonSerialize() |
||
209 | |||
210 | /** |
||
211 | * Convert the Payload instance to an array. |
||
212 | * |
||
213 | * @return array |
||
214 | */ |
||
215 | public function toArray() |
||
222 | |||
223 | /** |
||
224 | * Determine if the given attribute exists. |
||
225 | * |
||
226 | * @param mixed $offset |
||
227 | * |
||
228 | * @return bool |
||
229 | */ |
||
230 | public function offsetExists($offset) |
||
234 | |||
235 | /** |
||
236 | * Get the value for a given offset. |
||
237 | * |
||
238 | * @param mixed $offset |
||
239 | * |
||
240 | * @return mixed |
||
241 | */ |
||
242 | public function offsetGet($offset) |
||
246 | |||
247 | /** |
||
248 | * Set the value for a given offset. |
||
249 | * |
||
250 | * @param mixed $offset |
||
251 | * @param mixed $value |
||
252 | */ |
||
253 | public function offsetSet($offset, $value) |
||
257 | |||
258 | /** |
||
259 | * Unset the value for a given offset. |
||
260 | * |
||
261 | * @param mixed $offset |
||
262 | */ |
||
263 | public function offsetUnset($offset) |
||
267 | |||
268 | /** |
||
269 | * Determine if an attribute exists on the Payload. |
||
270 | * |
||
271 | * @param string $key |
||
272 | * |
||
273 | * @return bool |
||
274 | */ |
||
275 | public function __isset($key) |
||
283 | |||
284 | /** |
||
285 | * Unset an attribute on the Payload. |
||
286 | * |
||
287 | * @param string $key |
||
288 | */ |
||
289 | public function __unset($key) |
||
297 | |||
298 | /** |
||
299 | * Convert the Payload to its string representation. |
||
300 | * |
||
301 | * @return string |
||
302 | */ |
||
303 | public function __toString() |
||
307 | } |
||
308 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.