1 | <?php |
||
24 | class HttpAdapter |
||
25 | { |
||
26 | /** |
||
27 | * @var HttpAsyncClient |
||
28 | */ |
||
29 | private $httpClient; |
||
30 | |||
31 | /** |
||
32 | * @var UriFactory |
||
33 | */ |
||
34 | private $uriFactory; |
||
35 | |||
36 | /** |
||
37 | * Queued requests |
||
38 | * |
||
39 | * @var RequestInterface[] |
||
40 | */ |
||
41 | private $queue = []; |
||
42 | |||
43 | /** |
||
44 | * Caching proxy server host names or IP addresses. |
||
45 | * |
||
46 | * @var UriInterface[] |
||
47 | */ |
||
48 | private $servers; |
||
49 | |||
50 | /** |
||
51 | * Application host name and optional base URL. |
||
52 | * |
||
53 | * @var UriInterface |
||
54 | */ |
||
55 | private $baseUri; |
||
56 | |||
57 | /** |
||
58 | * @param string[] $servers Caching proxy server hostnames or IP |
||
59 | * addresses, including port if not port 80. |
||
60 | * E.g. ['127.0.0.1:6081'] |
||
61 | * @param string $baseUri Default application hostname, optionally |
||
62 | * including base URL, for purge and refresh |
||
63 | 45 | * requests (optional). This is required if |
|
64 | * you purge and refresh paths instead of |
||
65 | 45 | * absolute URLs. |
|
66 | 42 | * @param HttpAsyncClient $httpClient |
|
67 | 42 | * @param UriFactory $uriFactory |
|
68 | 42 | */ |
|
69 | public function __construct(array $servers, $baseUri, HttpAsyncClient $httpClient, UriFactory $uriFactory) |
||
76 | |||
77 | 37 | /** |
|
78 | * Queue invalidation request. |
||
79 | 37 | * |
|
80 | 1 | * @param RequestInterface $invalidationRequest |
|
81 | */ |
||
82 | public function invalidate(RequestInterface $invalidationRequest) |
||
92 | |||
93 | 38 | /** |
|
94 | * Send all pending invalidation requests and make sure the requests have terminated and gather exceptions. |
||
95 | 38 | * |
|
96 | 38 | * @return int The number of cache invalidations performed per caching server. |
|
97 | * |
||
98 | 38 | * @throws ExceptionCollection If any errors occurred during flush. |
|
99 | */ |
||
100 | 38 | public function flush() |
|
137 | |||
138 | 37 | /** |
|
139 | * Duplicate a request for each caching server |
||
140 | 37 | * |
|
141 | * @param RequestInterface $request The request to duplicate for each configured server |
||
142 | 37 | * |
|
143 | * @return RequestInterface[] |
||
144 | */ |
||
145 | private function fanOut(RequestInterface $request) |
||
195 | |||
196 | /** |
||
197 | * Set caching proxy server URI objects, validating them. |
||
198 | * |
||
199 | 45 | * @param string[] $servers Caching proxy proxy server hostnames or IP |
|
200 | * addresses, including port if not port 80. |
||
201 | 45 | * E.g. ['127.0.0.1:6081'] |
|
202 | 45 | * |
|
203 | 45 | * @throws InvalidUrlException If server is invalid or contains URL |
|
204 | 42 | * parts other than scheme, host, port |
|
205 | 42 | */ |
|
206 | private function setServers(array $servers) |
||
213 | |||
214 | /** |
||
215 | 42 | * Set application base URI that will be prefixed to relative purge and |
|
216 | * refresh requests, and validate it. |
||
217 | 42 | * |
|
218 | 6 | * @param string $uriString Your application’s base URI |
|
219 | * |
||
220 | 6 | * @throws InvalidUrlException If the base URI is not a valid URI. |
|
221 | */ |
||
222 | private function setBaseUri($uriString = null) |
||
232 | |||
233 | /** |
||
234 | * Filter a URL |
||
235 | * |
||
236 | * Prefix the URL with "http://" if it has no scheme, then check the URL |
||
237 | * for validity. You can specify what parts of the URL are allowed. |
||
238 | * |
||
239 | * @param string $uriString |
||
240 | 45 | * @param string[] $allowedParts Array of allowed URL parts (optional) |
|
241 | * |
||
242 | * @return UriInterface Filtered URI (with default scheme if there was no scheme) |
||
243 | * |
||
244 | * @throws InvalidUrlException If URL is invalid, the scheme is not http or |
||
245 | 45 | * contains parts that are not expected. |
|
246 | 40 | */ |
|
247 | 40 | private function filterUri($uriString, array $allowedParts = []) |
|
276 | |||
277 | /** |
||
278 | * Build a request signature based on the request data. Unique for every different request, identical |
||
279 | * for the same requests. |
||
280 | 37 | * |
|
281 | * This signature is used to avoid sending the same invalidation request twice. |
||
282 | 37 | * |
|
283 | 37 | * @param RequestInterface $request An invalidation request. |
|
284 | * |
||
285 | 37 | * @return string A signature for this request. |
|
286 | */ |
||
287 | private function getRequestSignature(RequestInterface $request) |
||
294 | } |
||
295 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: