1 | <?php |
||
9 | class ConnectionCounter |
||
10 | { |
||
11 | /** |
||
12 | * Options. |
||
13 | * @var CoOption |
||
14 | */ |
||
15 | private $options; |
||
16 | |||
17 | /** |
||
18 | * The number of whole running TCP connections. |
||
19 | * @var array |
||
20 | */ |
||
21 | private $connectionCount = 0; |
||
22 | |||
23 | /** |
||
24 | * Counts per destination. |
||
25 | * key => identifier |
||
26 | * value => count |
||
27 | * @var array |
||
28 | */ |
||
29 | private $destinations = []; |
||
30 | |||
31 | /** |
||
32 | * Constructor. |
||
33 | * @param CoOption $options |
||
34 | */ |
||
35 | 26 | public function __construct(CoOption $options) |
|
39 | |||
40 | /** |
||
41 | * Add destination info. |
||
42 | * @param resource $ch |
||
43 | */ |
||
44 | 13 | public function addDestination($ch) |
|
58 | |||
59 | /** |
||
60 | * Check if internal cURL pool is filled. |
||
61 | * @param resource $ch |
||
62 | * @return bool |
||
63 | */ |
||
64 | 13 | public function isPoolFilled($ch) |
|
73 | |||
74 | /** |
||
75 | * Remove destination info. |
||
76 | * @param resource $ch |
||
77 | */ |
||
78 | 10 | public function removeDestination($ch) |
|
92 | |||
93 | /** |
||
94 | * Push into queue. |
||
95 | * @param resource $ch |
||
96 | * @return string |
||
97 | */ |
||
98 | 13 | private function getIdentifier($ch) |
|
102 | } |
||
103 |