1 | <?php |
||
11 | class Payload implements PayloadContract, ArrayAccess, JsonSerializable, Jsonable, Arrayable |
||
12 | { |
||
13 | /** @var int */ |
||
14 | private $status; |
||
15 | |||
16 | /** @var mixed */ |
||
17 | private $output; |
||
18 | |||
19 | /** @var array */ |
||
20 | private $messages = []; |
||
21 | |||
22 | /** @var string|null */ |
||
23 | private $outputWrapper = null; |
||
24 | |||
25 | /** @var string */ |
||
26 | private $messagesWrapper = 'messages'; |
||
27 | |||
28 | /** |
||
29 | * Set the Payload status. |
||
30 | * |
||
31 | * @param int $status |
||
32 | * |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function setStatus($status) |
||
41 | |||
42 | /** |
||
43 | * Get the status of the payload. |
||
44 | * |
||
45 | * @return int |
||
46 | */ |
||
47 | public function getStatus() |
||
51 | |||
52 | /** |
||
53 | * Set the Payload messages. |
||
54 | * |
||
55 | * @param array $output |
||
|
|||
56 | * |
||
57 | * @return $this |
||
58 | */ |
||
59 | public function setMessages(array $messages) |
||
65 | |||
66 | /** |
||
67 | * Get messages array from the payload. |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | public function getMessages() |
||
75 | |||
76 | /** |
||
77 | * Set the Payload output. |
||
78 | * |
||
79 | * @param mixed $output |
||
80 | * @param string|null $wrapper |
||
81 | * |
||
82 | * @return $this |
||
83 | */ |
||
84 | public function setOutput($output, ? string $wrapper = null) |
||
94 | |||
95 | /** |
||
96 | * Get the Payload output. |
||
97 | * |
||
98 | * @return array |
||
99 | */ |
||
100 | public function getOutput() |
||
104 | |||
105 | /** |
||
106 | * Get the unwrapped Payload output. Alias for getOutput. |
||
107 | * |
||
108 | * @return array |
||
109 | */ |
||
110 | public function getUnwrappedOutput() |
||
114 | |||
115 | /** |
||
116 | * Retrieve the Payload output and wrap it. |
||
117 | * Use the outputWrapper if it is set. Otherwise use 'data'. |
||
118 | * |
||
119 | * @return array |
||
120 | */ |
||
121 | public function getwrappedOutput() |
||
125 | |||
126 | /** |
||
127 | * Set a wrapper for payload output. |
||
128 | * |
||
129 | * @param string $wrapper |
||
130 | * |
||
131 | * @return $this |
||
132 | */ |
||
133 | private function setOutputWrapper(string $wrapper) |
||
139 | |||
140 | /** |
||
141 | * Get the wrapper for the output. |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | public function getOutputWrapper() |
||
149 | |||
150 | /** |
||
151 | * Get the wrapper for the messages. |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | public function getMessagesWrapper() |
||
159 | |||
160 | /** |
||
161 | * Dynamically retrieve attributes on the OutputItem. |
||
162 | * |
||
163 | * @param string $key |
||
164 | * |
||
165 | * @return mixed |
||
166 | */ |
||
167 | public function __get($key) |
||
171 | |||
172 | /** |
||
173 | * Convert the Payload instance to JSON. |
||
174 | * |
||
175 | * @param int $options |
||
176 | * |
||
177 | * @return string |
||
178 | */ |
||
179 | public function toJson($options = 0) |
||
183 | |||
184 | /** |
||
185 | * Convert the Payload into something JSON serializable. |
||
186 | * |
||
187 | * @return array |
||
188 | */ |
||
189 | public function jsonSerialize() |
||
193 | |||
194 | /** |
||
195 | * Convert the Payload instance to an array. |
||
196 | * |
||
197 | * @return array |
||
198 | */ |
||
199 | public function toArray() |
||
205 | |||
206 | /** |
||
207 | * Determine if the given attribute exists. |
||
208 | * |
||
209 | * @param mixed $offset |
||
210 | * |
||
211 | * @return bool |
||
212 | */ |
||
213 | public function offsetExists($offset) |
||
217 | |||
218 | /** |
||
219 | * Get the value for a given offset. |
||
220 | * |
||
221 | * @param mixed $offset |
||
222 | * |
||
223 | * @return mixed |
||
224 | */ |
||
225 | public function offsetGet($offset) |
||
229 | |||
230 | /** |
||
231 | * Set the value for a given offset. |
||
232 | * |
||
233 | * @param mixed $offset |
||
234 | * @param mixed $value |
||
235 | */ |
||
236 | public function offsetSet($offset, $value) |
||
240 | |||
241 | /** |
||
242 | * Unset the value for a given offset. |
||
243 | * |
||
244 | * @param mixed $offset |
||
245 | */ |
||
246 | public function offsetUnset($offset) |
||
250 | |||
251 | /** |
||
252 | * Determine if an attribute exists on the Payload. |
||
253 | * |
||
254 | * @param string $key |
||
255 | * |
||
256 | * @return bool |
||
257 | */ |
||
258 | public function __isset($key) |
||
266 | |||
267 | /** |
||
268 | * Unset an attribute on the Payload. |
||
269 | * |
||
270 | * @param string $key |
||
271 | */ |
||
272 | public function __unset($key) |
||
280 | |||
281 | /** |
||
282 | * Convert the Payload to its string representation. |
||
283 | * |
||
284 | * @return string |
||
285 | */ |
||
286 | public function __toString() |
||
290 | } |
||
291 |
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.