1 | <?php |
||
13 | class ClientDataProvider |
||
14 | { |
||
15 | /** |
||
16 | * Array that tell if a request errored or not. true = success, false = failure. |
||
17 | * @var array |
||
18 | */ |
||
19 | private $failure; |
||
20 | |||
21 | /** |
||
22 | * A multidimensional array with requests. |
||
23 | * $requests[0][0] is the first request before all plugins. |
||
24 | * $requests[0][1] is the first request after the first plugin. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | private $requests; |
||
29 | |||
30 | /** |
||
31 | * A multidimensional array with responses. |
||
32 | * $responses[0][0] is the first responses before all plugins. |
||
33 | * $responses[0][1] is the first responses after the first plugin. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | private $responses; |
||
38 | |||
39 | /** |
||
40 | * @param array $failure if the response was successful or not |
||
41 | * @param array $requests |
||
42 | * @param array $responses |
||
43 | */ |
||
44 | public function __construct(array $failure, array $requests, array $responses) |
||
50 | |||
51 | /** |
||
52 | * Create an array of ClientDataCollector from collected data. |
||
53 | * |
||
54 | * @param array $data |
||
55 | * |
||
56 | * @return ClientDataProvider[] |
||
57 | */ |
||
58 | public static function createFromCollectedData(array $data) |
||
67 | |||
68 | /** |
||
69 | * @param array $messages is an array with keys 'failure', 'request' and 'response' which hold requests for each call to |
||
70 | * sendRequest and for each depth. |
||
71 | * |
||
72 | * @return ClientDataProvider |
||
73 | */ |
||
74 | private static function createOne($messages) |
||
100 | |||
101 | /** |
||
102 | * @return array |
||
103 | */ |
||
104 | public function getRequests() |
||
108 | |||
109 | /** |
||
110 | * @param array $requests |
||
111 | * |
||
112 | * @return ClientDataProvider |
||
113 | */ |
||
114 | public function setRequests($requests) |
||
120 | |||
121 | /** |
||
122 | * @return array |
||
123 | */ |
||
124 | public function getResponses() |
||
128 | |||
129 | /** |
||
130 | * @param array $responses |
||
131 | * |
||
132 | * @return ClientDataProvider |
||
133 | */ |
||
134 | public function setResponses($responses) |
||
140 | |||
141 | /** |
||
142 | * Get the index keys for the request and response stacks. |
||
143 | * |
||
144 | * @return array |
||
145 | */ |
||
146 | public function getStackIndexKeys() |
||
150 | |||
151 | /** |
||
152 | * @param int $idx |
||
153 | * |
||
154 | * @return array responses |
||
155 | */ |
||
156 | public function getRequstStack($idx) |
||
160 | |||
161 | /** |
||
162 | * @param int $idx |
||
163 | * |
||
164 | * @return array responses |
||
165 | */ |
||
166 | public function getResponseStack($idx) |
||
170 | |||
171 | /** |
||
172 | * @param int $idx |
||
173 | * |
||
174 | * @return array failures |
||
175 | */ |
||
176 | public function getFailureStack($idx) |
||
180 | } |
||
181 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: