/
home
/
clp
/
htdocs
/
app
/
files
/
src
/
Site
/
VarnishCache
/
up file
home
<?php namespace App\Site\VarnishCache; use GuzzleHttp\Client as HttpClient; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; use App\Util\Retry; class Client { const HTTP_CLIENT_TIMEOUT = 10; private ?HttpClient $httpClient = null; private ?string $server = null; public function setServer(?string $server) : void { $this->server = $server; } public function getServer() : ?string { return $this->server; } public function purgeUrl(string $url) : void { goto fc9bb; ea1e2: if (!(true === isset($parsedUrl["\160\x61\x74\150"]))) { goto D1a27; } goto d1064; C061b: e0f0f: goto F8608; D95d7: $requestUrl = $server; goto ea1e2; e2735: parse_str($queryString, $queryParams); goto B28c0; ef527: $requestUrl = sprintf("\x25\163\x3f\x25\x73", $requestUrl, $queryString); goto f44ce; C25ab: $queryString = http_build_query($queryParams); goto ef527; fc9bb: $server = $this->getServer(); goto e72b8; ac13c: $this->sendPurgeRequest($requestUrl, $headers); goto C0f63; d1064: $path = $parsedUrl["\x70\141\164\150"]; goto Fd368; e3980: Cf2da: goto fb81e; Fd368: $requestUrl = sprintf("\x25\x73\57\45\x73", $requestUrl, "\x2f" == $path ? '' : ltrim($path, "\x2f")); goto daf4f; f17b4: throw new \Exception(sprintf("\116\157\164\40\x61\40\166\x61\x6c\151\x64\40\165\x72\154\72\40\45\x73", $url)); goto E6dea; C0f63: C9548: goto ab5f9; e68de: if (!(false === empty($queryString))) { goto e0f0f; } goto e2735; B2e22: $queryString = parse_url($url, PHP_URL_QUERY); goto e68de; E6dea: goto C9548; goto e3980; f44ce: E405a: goto C061b; d0983: if (true === isset($parsedUrl["\150\157\x73\x74"])) { goto Cf2da; } goto f17b4; fb81e: $host = $parsedUrl["\x68\157\163\x74"]; goto D95d7; e72b8: $parsedUrl = parse_url($url); goto d0983; B28c0: if (!(false === empty($queryParams))) { goto E405a; } goto C25ab; F8608: $headers = ["\110\157\163\164" => $host]; goto ac13c; daf4f: D1a27: goto B2e22; ab5f9: } public function purgeHost(string $host) : void { goto fbebe; fbebe: $server = $this->getServer(); goto c918c; c918c: $headers = ["\110\x6f\x73\164" => $host]; goto bcac0; bcac0: $this->sendPurgeRequest($server, $headers); goto C977c; C977c: } public function purgeTag(string $tag) : void { $this->purgeTags([$tag]); } public function purgeTags(array $tags) : void { goto Ab9d9; faa66: $this->sendPurgeRequest($server, $headers); goto d7e9e; Ab9d9: $server = $this->getServer(); goto B2cf8; B2cf8: $headers = ["\130\55\x43\141\143\x68\x65\55\124\141\x67\x73" => implode("\x2c", $tags)]; goto faa66; d7e9e: } private function sendPurgeRequest(string $requestUrl, array $headers) : void { goto fcd15; e197d: $httpClient = $this->getHttpClient(); goto d616d; fcd15: $request = new Request("\120\125\x52\107\105", $requestUrl, $headers); goto e197d; d616d: $httpClient->send($request); goto C2014; C2014: } private function getHttpClient() : HttpClient { goto d9fcc; C24c6: $config = ["\x74\151\155\x65\x6f\x75\164" => self::HTTP_CLIENT_TIMEOUT, "\x76\x65\162\151\x66\x79" => false]; goto ad3f0; F43e5: dbee7: goto b41f0; b41f0: return $this->httpClient; goto cdff9; d9fcc: if (!(true === is_null($this->httpClient))) { goto dbee7; } goto C24c6; ad3f0: $this->httpClient = new HttpClient($config); goto F43e5; cdff9: } private function retry(callable $fn, $retries = 1, $delay = 3) { return Retry::retry($fn, $retries, $delay); } }