1 | <?php |
||
32 | class HttpAdapter |
||
33 | { |
||
34 | /** |
||
35 | * @var HttpAsyncClient |
||
36 | */ |
||
37 | private $httpClient; |
||
38 | |||
39 | /** |
||
40 | * @var UriFactory |
||
41 | */ |
||
42 | private $uriFactory; |
||
43 | |||
44 | /** |
||
45 | * Queued requests. |
||
46 | * |
||
47 | * @var RequestInterface[] |
||
48 | */ |
||
49 | private $queue = []; |
||
50 | |||
51 | /** |
||
52 | * Caching proxy server host names or IP addresses. |
||
53 | * |
||
54 | * @var UriInterface[] |
||
55 | */ |
||
56 | private $servers; |
||
57 | |||
58 | /** |
||
59 | * Application host name and optional base URL. |
||
60 | * |
||
61 | * @var UriInterface |
||
62 | */ |
||
63 | private $baseUri; |
||
64 | |||
65 | /** |
||
66 | * @param string[] $servers Caching proxy server hostnames or IP |
||
67 | * addresses, including port if not port 80. |
||
68 | * E.g. ['127.0.0.1:6081'] |
||
69 | * @param string $baseUri Default application hostname, optionally |
||
70 | * including base URL, for purge and refresh |
||
71 | * requests (optional). This is required if |
||
72 | * you purge and refresh paths instead of |
||
73 | * absolute URLs. |
||
74 | * @param HttpAsyncClient $httpClient |
||
75 | * @param UriFactory $uriFactory |
||
76 | */ |
||
77 | 48 | public function __construct(array $servers, $baseUri, HttpAsyncClient $httpClient, UriFactory $uriFactory) |
|
85 | |||
86 | /** |
||
87 | * Queue invalidation request. |
||
88 | * |
||
89 | * @param RequestInterface $invalidationRequest |
||
90 | */ |
||
91 | 38 | public function invalidate(RequestInterface $invalidationRequest) |
|
101 | |||
102 | /** |
||
103 | * Send all pending invalidation requests and make sure the requests have terminated and gather exceptions. |
||
104 | * |
||
105 | * @return int The number of cache invalidations performed per caching server. |
||
106 | * |
||
107 | * @throws ExceptionCollection If any errors occurred during flush. |
||
108 | */ |
||
109 | 39 | public function flush() |
|
146 | |||
147 | /** |
||
148 | * Duplicate a request for each caching server. |
||
149 | * |
||
150 | * @param RequestInterface $request The request to duplicate for each configured server |
||
151 | * |
||
152 | * @return RequestInterface[] |
||
153 | */ |
||
154 | 38 | private function fanOut(RequestInterface $request) |
|
203 | |||
204 | /** |
||
205 | * Set caching proxy server URI objects, validating them. |
||
206 | * |
||
207 | * @param string[] $servers Caching proxy proxy server hostnames or IP |
||
208 | * addresses, including port if not port 80. |
||
209 | * E.g. ['127.0.0.1:6081'] |
||
210 | * |
||
211 | * @throws InvalidUrlException If server is invalid or contains URL |
||
212 | * parts other than scheme, host, port |
||
213 | */ |
||
214 | 48 | private function setServers(array $servers) |
|
221 | |||
222 | /** |
||
223 | * Set application base URI that will be prefixed to relative purge and |
||
224 | * refresh requests, and validate it. |
||
225 | * |
||
226 | * @param string $uriString Your application’s base URI |
||
227 | * |
||
228 | * @throws InvalidUrlException If the base URI is not a valid URI. |
||
229 | */ |
||
230 | 45 | private function setBaseUri($uriString = null) |
|
240 | |||
241 | /** |
||
242 | * Filter a URL. |
||
243 | * |
||
244 | * Prefix the URL with "http://" if it has no scheme, then check the URL |
||
245 | * for validity. You can specify what parts of the URL are allowed. |
||
246 | * |
||
247 | * @param string $uriString |
||
248 | * @param string[] $allowedParts Array of allowed URL parts (optional) |
||
249 | * |
||
250 | * @return UriInterface Filtered URI (with default scheme if there was no scheme) |
||
251 | * |
||
252 | * @throws InvalidUrlException If URL is invalid, the scheme is not http or |
||
253 | * contains parts that are not expected. |
||
254 | */ |
||
255 | 48 | private function filterUri($uriString, array $allowedParts = []) |
|
284 | |||
285 | /** |
||
286 | * Build a request signature based on the request data. Unique for every different request, identical |
||
287 | * for the same requests. |
||
288 | * |
||
289 | * This signature is used to avoid sending the same invalidation request twice. |
||
290 | * |
||
291 | * @param RequestInterface $request An invalidation request. |
||
292 | * |
||
293 | * @return string A signature for this request. |
||
294 | */ |
||
295 | 38 | private function getRequestSignature(RequestInterface $request) |
|
302 | } |
||
303 |
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: