1 | <?php |
||
21 | class MultiRequest{ |
||
22 | |||
23 | /** |
||
24 | * the curl_multi master handle |
||
25 | * |
||
26 | * @var resource |
||
27 | */ |
||
28 | protected $curl_multi; |
||
29 | |||
30 | /** |
||
31 | * cURL options for each handle |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $curl_options = []; |
||
36 | |||
37 | /** |
||
38 | * An array of the request URLs |
||
39 | * |
||
40 | * @var array<\chillerlan\TinyCurl\URL> |
||
41 | */ |
||
42 | protected $stack = []; |
||
43 | |||
44 | /** |
||
45 | * The returned value from MultiResponseHandlerInterface::handleResponse() for each request |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $responses = []; |
||
50 | |||
51 | /** |
||
52 | * @var \chillerlan\TinyCurl\MultiRequestOptions |
||
53 | */ |
||
54 | protected $options; |
||
55 | |||
56 | /** |
||
57 | * @var \chillerlan\TinyCurl\MultiResponseHandlerInterface |
||
58 | */ |
||
59 | protected $multiResponseHandler; |
||
60 | |||
61 | /** |
||
62 | * MultiRequest constructor. |
||
63 | * |
||
64 | * @param \chillerlan\TinyCurl\MultiRequestOptions $options |
||
|
|||
65 | */ |
||
66 | public function __construct(MultiRequestOptions $options = null){ |
||
69 | |||
70 | /** |
||
71 | * closes the curl_multi instance |
||
72 | * |
||
73 | * @codeCoverageIgnore |
||
74 | */ |
||
75 | public function __destruct(){ |
||
80 | |||
81 | /** |
||
82 | * @param \chillerlan\TinyCurl\MultiRequestOptions $options |
||
83 | * |
||
84 | * @return \chillerlan\TinyCurl\MultiRequest |
||
85 | * @throws \chillerlan\TinyCurl\RequestException |
||
86 | */ |
||
87 | public function setOptions(MultiRequestOptions $options):MultiRequest { |
||
106 | |||
107 | /** |
||
108 | * @param \chillerlan\TinyCurl\MultiResponseHandlerInterface $handler |
||
109 | * |
||
110 | * @return \chillerlan\TinyCurl\MultiRequest |
||
111 | * @throws \chillerlan\TinyCurl\RequestException |
||
112 | */ |
||
113 | public function setHandler(MultiResponseHandlerInterface $handler = null):MultiRequest { |
||
133 | |||
134 | /** |
||
135 | * @param array $urls array of \chillerlan\TinyCurl\URL objects |
||
136 | * |
||
137 | * @return void |
||
138 | * @throws \chillerlan\TinyCurl\RequestException |
||
139 | */ |
||
140 | public function fetch(array $urls){ |
||
160 | |||
161 | /** |
||
162 | * @see \chillerlan\TinyCurl\MultiResponseHandlerInterface |
||
163 | * |
||
164 | * @param mixed $response |
||
165 | * |
||
166 | * @return void |
||
167 | */ |
||
168 | public function addResponse($response){ |
||
171 | |||
172 | /** |
||
173 | * @return array |
||
174 | */ |
||
175 | public function getResponseData():array { |
||
178 | |||
179 | /** |
||
180 | * creates a new cURL handle |
||
181 | * |
||
182 | * @return void |
||
183 | */ |
||
184 | protected function createHandle(){ |
||
208 | |||
209 | /** |
||
210 | * processes the requests |
||
211 | * |
||
212 | * @return void |
||
213 | */ |
||
214 | protected function processStack(){ |
||
244 | |||
245 | } |
||
246 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.