1 | <?php |
||
24 | class HttpAdapter |
||
25 | { |
||
26 | /** |
||
27 | * @var HttpAsyncClient |
||
28 | */ |
||
29 | private $httpClient; |
||
30 | |||
31 | /** |
||
32 | * Queued requests |
||
33 | * |
||
34 | * @var RequestInterface[] |
||
35 | */ |
||
36 | private $queue = []; |
||
37 | |||
38 | /** |
||
39 | * Caching proxy server host names or IP addresses. |
||
40 | * |
||
41 | * @var UriInterface[] |
||
42 | */ |
||
43 | private $servers; |
||
44 | |||
45 | /** |
||
46 | * Application host name and optional base URL. |
||
47 | * |
||
48 | * @var UriInterface |
||
49 | */ |
||
50 | private $baseUri; |
||
51 | |||
52 | /** |
||
53 | * @param string[] $servers Caching proxy server hostnames or IP |
||
54 | * addresses, including port if not port 80. |
||
55 | * E.g. ['127.0.0.1:6081'] |
||
56 | * @param string $baseUri Default application hostname, optionally |
||
57 | * including base URL, for purge and refresh |
||
58 | * requests (optional). This is required if |
||
59 | * you purge and refresh paths instead of |
||
60 | * absolute URLs. |
||
61 | * @param HttpAsyncClient $httpClient |
||
62 | */ |
||
63 | 45 | public function __construct(array $servers, $baseUri, HttpAsyncClient $httpClient) |
|
69 | |||
70 | /** |
||
71 | * Queue invalidation request. |
||
72 | * |
||
73 | * @param RequestInterface $invalidationRequest |
||
74 | */ |
||
75 | 37 | public function invalidate(RequestInterface $invalidationRequest) |
|
85 | |||
86 | /** |
||
87 | * Send all pending invalidation requests and make sure the requests have terminated and gather exceptions. |
||
88 | * |
||
89 | * @return int The number of cache invalidations performed per caching server. |
||
90 | * |
||
91 | * @throws ExceptionCollection If any errors occurred during flush. |
||
92 | */ |
||
93 | 38 | public function flush() |
|
130 | |||
131 | /** |
||
132 | * Duplicate a request for each caching server |
||
133 | * |
||
134 | * @param RequestInterface $request The request to duplicate for each configured server |
||
135 | * |
||
136 | * @return RequestInterface[] |
||
137 | */ |
||
138 | 37 | private function fanOut(RequestInterface $request) |
|
188 | |||
189 | /** |
||
190 | * Set caching proxy server URI objects, validating them. |
||
191 | * |
||
192 | * @param string[] $servers Caching proxy proxy server hostnames or IP |
||
193 | * addresses, including port if not port 80. |
||
194 | * E.g. ['127.0.0.1:6081'] |
||
195 | * |
||
196 | * @throws InvalidUrlException If server is invalid or contains URL |
||
197 | * parts other than scheme, host, port |
||
198 | */ |
||
199 | 45 | private function setServers(array $servers) |
|
206 | |||
207 | /** |
||
208 | * Set application base URI that will be prefixed to relative purge and |
||
209 | * refresh requests, and validate it. |
||
210 | * |
||
211 | * @param string $uriString Your application’s base URI |
||
212 | * |
||
213 | * @throws InvalidUrlException If the base URI is not a valid URI. |
||
214 | */ |
||
215 | 42 | private function setBaseUri($uriString = null) |
|
225 | |||
226 | /** |
||
227 | * Filter a URL |
||
228 | * |
||
229 | * Prefix the URL with "http://" if it has no scheme, then check the URL |
||
230 | * for validity. You can specify what parts of the URL are allowed. |
||
231 | * |
||
232 | * @param string $uriString |
||
233 | * @param string[] $allowedParts Array of allowed URL parts (optional) |
||
234 | * |
||
235 | * @return UriInterface Filtered URI (with default scheme if there was no scheme) |
||
236 | * |
||
237 | * @throws InvalidUrlException If URL is invalid, the scheme is not http or |
||
238 | * contains parts that are not expected. |
||
239 | */ |
||
240 | 45 | private function filterUri($uriString, array $allowedParts = []) |
|
269 | |||
270 | /** |
||
271 | * Build a request signature based on the request data. Unique for every different request, identical |
||
272 | * for the same requests. |
||
273 | * |
||
274 | * This signature is used to avoid sending the same invalidation request twice. |
||
275 | * |
||
276 | * @param RequestInterface $request An invalidation request. |
||
277 | * |
||
278 | * @return string A signature for this request. |
||
279 | */ |
||
280 | 37 | private function getRequestSignature(RequestInterface $request) |
|
287 | } |
||
288 |
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: