1 | <?php |
||
19 | class Pool { |
||
20 | /** |
||
21 | * @var array |
||
22 | */ |
||
23 | private $queries = [ ]; |
||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | private $promises = [ ]; |
||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private $transformers = [ ]; |
||
32 | /** |
||
33 | * @var AbstractCachePool |
||
34 | */ |
||
35 | private $cachePool = null; |
||
36 | /** |
||
37 | * @var Client |
||
38 | */ |
||
39 | protected $client = null; |
||
40 | /** |
||
41 | * @var bool|string |
||
42 | */ |
||
43 | private $cacheKey = false; |
||
44 | /** |
||
45 | * @var array |
||
46 | */ |
||
47 | private $cacheData = [ ]; |
||
48 | /** |
||
49 | * This will be mostly used for testing. |
||
50 | * It also gives quite good informations on life of object for debugging. |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | public $debug = [ |
||
55 | 'attachedqueries' => 0, |
||
56 | 'attachedpromises' => 0, |
||
57 | 'executedqueries' => 0, |
||
58 | 'executedpromises' => 0, //will include also queries |
||
59 | 'queriesrestoredfromcache' => 0, |
||
60 | ]; |
||
61 | |||
62 | /** |
||
63 | * Pool constructor. |
||
64 | */ |
||
65 | 2 | public function __construct() { |
|
68 | |||
69 | /** |
||
70 | * let us keep reference to our client. |
||
71 | * |
||
72 | * @return mixed |
||
73 | */ |
||
74 | 2 | public function getClient() { |
|
77 | |||
78 | /** |
||
79 | * Awaits all the requests attaching callbacks before. |
||
80 | * |
||
81 | * @return mixed |
||
82 | */ |
||
83 | 2 | public function unwrap() { |
|
117 | |||
118 | /** |
||
119 | * @return array |
||
120 | */ |
||
121 | 2 | private function flushPromises() { |
|
140 | |||
141 | /** |
||
142 | * @param Promise $req |
||
143 | * |
||
144 | * @return Promise Promise with attached transformers |
||
145 | */ |
||
146 | 2 | private function attachTransforms( Promise $req ) { |
|
170 | |||
171 | /** |
||
172 | * GETTERS AND SETTERS. |
||
173 | */ |
||
174 | /** |
||
175 | * @param $query |
||
176 | * |
||
177 | * @return $this |
||
178 | */ |
||
179 | 2 | public function addQuery( $key, $query ) { |
|
185 | |||
186 | /** |
||
187 | * @param Promise $promise |
||
188 | */ |
||
189 | 2 | public function addPromise( $name, Promise $promise ) { |
|
193 | |||
194 | /** |
||
195 | * @return array |
||
196 | */ |
||
197 | 2 | public function getTransformers() { |
|
200 | |||
201 | /** |
||
202 | * Adds another transformer to collection of transformers. |
||
203 | * |
||
204 | * @param callable $transformer |
||
205 | * |
||
206 | * @return $this |
||
207 | */ |
||
208 | 2 | public function addTransformer( callable $transformer ) { |
|
213 | |||
214 | /** |
||
215 | * Cache pool getter. |
||
216 | */ |
||
217 | 2 | public function getCachePool() { |
|
220 | |||
221 | /** |
||
222 | * @param null $cachePool |
||
223 | */ |
||
224 | public function setCachePool( $cachePool ) { |
||
229 | |||
230 | /** |
||
231 | * Let us set our client reference taken from transaction. |
||
232 | * |
||
233 | * @param $client |
||
234 | * |
||
235 | * @return Client |
||
236 | */ |
||
237 | 2 | public function setClient( Client $client ) { |
|
242 | |||
243 | /** |
||
244 | * @param bool|string $cacheKey |
||
245 | * |
||
246 | * @return Pool |
||
247 | */ |
||
248 | public function setCacheKey( $cacheKey ) { |
||
253 | |||
254 | /** |
||
255 | * Cache key getter. |
||
256 | * |
||
257 | * @return bool|string |
||
258 | */ |
||
259 | 2 | public function getCacheKey() { |
|
262 | } |
||
263 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..