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 | * requests (optional). This is required if |
||
64 | * you purge and refresh paths instead of |
||
65 | * absolute URLs. |
||
66 | * @param HttpAsyncClient $httpClient |
||
67 | * @param UriFactory $uriFactory |
||
68 | */ |
||
69 | public function __construct(array $servers, $baseUri, HttpAsyncClient $httpClient, UriFactory $uriFactory) |
||
77 | |||
78 | /** |
||
79 | * Queue invalidation request. |
||
80 | * |
||
81 | * @param RequestInterface $invalidationRequest |
||
82 | */ |
||
83 | public function invalidate(RequestInterface $invalidationRequest) |
||
93 | |||
94 | /** |
||
95 | * Send all pending invalidation requests and make sure the requests have terminated and gather exceptions. |
||
96 | * |
||
97 | * @return int The number of cache invalidations performed per caching server. |
||
98 | * |
||
99 | * @throws ExceptionCollection If any errors occurred during flush. |
||
100 | */ |
||
101 | public function flush() |
||
138 | |||
139 | /** |
||
140 | * Duplicate a request for each caching server |
||
141 | * |
||
142 | * @param RequestInterface $request The request to duplicate for each configured server |
||
143 | * |
||
144 | * @return RequestInterface[] |
||
145 | */ |
||
146 | private function fanOut(RequestInterface $request) |
||
196 | |||
197 | /** |
||
198 | * Set caching proxy server URI objects, validating them. |
||
199 | * |
||
200 | * @param string[] $servers Caching proxy proxy server hostnames or IP |
||
201 | * addresses, including port if not port 80. |
||
202 | * E.g. ['127.0.0.1:6081'] |
||
203 | * |
||
204 | * @throws InvalidUrlException If server is invalid or contains URL |
||
205 | * parts other than scheme, host, port |
||
206 | */ |
||
207 | private function setServers(array $servers) |
||
214 | |||
215 | /** |
||
216 | * Set application base URI that will be prefixed to relative purge and |
||
217 | * refresh requests, and validate it. |
||
218 | * |
||
219 | * @param string $uriString Your application’s base URI |
||
220 | * |
||
221 | * @throws InvalidUrlException If the base URI is not a valid URI. |
||
222 | */ |
||
223 | private function setBaseUri($uriString = null) |
||
233 | |||
234 | /** |
||
235 | * Filter a URL |
||
236 | * |
||
237 | * Prefix the URL with "http://" if it has no scheme, then check the URL |
||
238 | * for validity. You can specify what parts of the URL are allowed. |
||
239 | * |
||
240 | * @param string $uriString |
||
241 | * @param string[] $allowedParts Array of allowed URL parts (optional) |
||
242 | * |
||
243 | * @return UriInterface Filtered URI (with default scheme if there was no scheme) |
||
244 | * |
||
245 | * @throws InvalidUrlException If URL is invalid, the scheme is not http or |
||
246 | * contains parts that are not expected. |
||
247 | */ |
||
248 | private function filterUri($uriString, array $allowedParts = []) |
||
277 | |||
278 | /** |
||
279 | * Build a request signature based on the request data. Unique for every different request, identical |
||
280 | * for the same requests. |
||
281 | * |
||
282 | * This signature is used to avoid sending the same invalidation request twice. |
||
283 | * |
||
284 | * @param RequestInterface $request An invalidation request. |
||
285 | * |
||
286 | * @return string A signature for this request. |
||
287 | */ |
||
288 | private function getRequestSignature(RequestInterface $request) |
||
295 | } |
||
296 |
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: