1 | <?php |
||
9 | class CURLPool |
||
10 | { |
||
11 | /** |
||
12 | * Options. |
||
13 | * @var CoOption |
||
14 | */ |
||
15 | private $options; |
||
16 | |||
17 | /** |
||
18 | * cURL multi handle. |
||
19 | * @var resource |
||
20 | */ |
||
21 | private $mh; |
||
22 | |||
23 | /** |
||
24 | * The number of dispatched cURL handle. |
||
25 | * @var int |
||
26 | */ |
||
27 | private $count = 0; |
||
28 | |||
29 | /** |
||
30 | * cURL handles those have not been dispatched. |
||
31 | * @var array |
||
32 | */ |
||
33 | private $queue = []; |
||
34 | |||
35 | /** |
||
36 | * React Deferreds. |
||
37 | * @var Deferred |
||
38 | */ |
||
39 | private $deferreds = []; |
||
40 | |||
41 | /** |
||
42 | * Constructor. |
||
43 | * Initialize cURL multi handle. |
||
44 | * @param CoOption $options |
||
45 | */ |
||
46 | 1 | public function __construct(CoOption $options) |
|
53 | |||
54 | /** |
||
55 | * Call curl_multi_add_handle() or push into queue. |
||
56 | * @param resource $ch |
||
57 | * @param Deferred $deferred |
||
58 | */ |
||
59 | public function addOrEnqueue($ch, $deferred = null) |
||
79 | |||
80 | /** |
||
81 | * Run curl_multi_exec() loop. |
||
82 | */ |
||
83 | 1 | public function wait() |
|
105 | |||
106 | /** |
||
107 | * Read completed cURL handles. |
||
108 | * @return array |
||
109 | */ |
||
110 | 1 | private function readEntries() |
|
126 | } |
||
127 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.