@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | return $storageItem; |
| 42 | 42 | } catch (InvalidArgumentException $e) { |
| 43 | - throw new \RuntimeException('Invalid cache key ' . $cacheKey, 0, $e); |
|
| 43 | + throw new \RuntimeException('Invalid cache key '.$cacheKey, 0, $e); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | $cacheItem->set($item); |
| 56 | 56 | $this->cachePool->save($cacheItem); |
| 57 | 57 | } catch (InvalidArgumentException $e) { |
| 58 | - throw new \RuntimeException('Invalid cache key ' . $cacheKey, 0, $e); |
|
| 58 | + throw new \RuntimeException('Invalid cache key '.$cacheKey, 0, $e); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | private function getCacheKey(string $domainName): string |
| 63 | 63 | { |
| 64 | - return rawurlencode('guzzle.doh.psr6.' . $domainName); |
|
| 64 | + return rawurlencode('guzzle.doh.psr6.'.$domainName); |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | return $storageItem; |
| 42 | 42 | } catch (InvalidArgumentException $e) { |
| 43 | - throw new \RuntimeException('Invalid cache key ' . $cacheKey, 0, $e); |
|
| 43 | + throw new \RuntimeException('Invalid cache key '.$cacheKey, 0, $e); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | try { |
| 53 | 53 | $this->cache->set($cacheKey, $item, $item->getTTL()); |
| 54 | 54 | } catch (InvalidArgumentException $e) { |
| 55 | - throw new \RuntimeException('Invalid cache key ' . $cacheKey, 0, $e); |
|
| 55 | + throw new \RuntimeException('Invalid cache key '.$cacheKey, 0, $e); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | private function getCacheKey(string $domainName): string |
| 60 | 60 | { |
| 61 | - return rawurlencode('guzzle.doh.psr16.' . $domainName); |
|
| 61 | + return rawurlencode('guzzle.doh.psr16.'.$domainName); |
|
| 62 | 62 | } |
| 63 | 63 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | $interval = \DateInterval::createFromDateString($ttl); |
| 57 | 57 | |
| 58 | 58 | if ($interval === false) { |
| 59 | - throw new \RuntimeException('Error create DateInterval from ' . $ttl); |
|
| 59 | + throw new \RuntimeException('Error create DateInterval from '.$ttl); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $ttl = $interval; |
@@ -135,14 +135,14 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | $ipAddressesString = implode(',', $ipAddresses); |
| 137 | 137 | $curlOptions[\CURLOPT_RESOLVE] = [ |
| 138 | - $domainName . ':80:' . $ipAddressesString, |
|
| 139 | - $domainName . ':443:' . $ipAddressesString, |
|
| 138 | + $domainName.':80:'.$ipAddressesString, |
|
| 139 | + $domainName.':443:'.$ipAddressesString, |
|
| 140 | 140 | ]; |
| 141 | 141 | |
| 142 | 142 | $port = $request->getUri()->getPort(); |
| 143 | 143 | |
| 144 | 144 | if ($port !== null && $port !== 80 && $port !== 443) { |
| 145 | - $curlOptions[\CURLOPT_RESOLVE][] = $domainName . ':' . $port . ':' . $ipAddressesString; |
|
| 145 | + $curlOptions[\CURLOPT_RESOLVE][] = $domainName.':'.$port.':'.$ipAddressesString; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if ($this->logger !== null) { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $promise = $handler($request, $options); |
| 162 | 162 | |
| 163 | 163 | return $promise->then( |
| 164 | - static function (ResponseInterface $response) use ($ipAddressesString, $resolvedItem) { |
|
| 164 | + static function(ResponseInterface $response) use ($ipAddressesString, $resolvedItem) { |
|
| 165 | 165 | if ($resolvedItem->cacheHit) { |
| 166 | 166 | $cacheTtl = max(0, $resolvedItem->getExpiredAt()->getTimestamp() - time()); |
| 167 | 167 | $response = $response->withHeader(self::HEADER_RESPONSE_CACHE_TTL, (string) $cacheTtl); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $storage = StorageFactory::create($cache); |
| 215 | 215 | |
| 216 | - return static function (callable $handler) use ($storage, $dohServers, $logger, $debug) { |
|
| 216 | + return static function(callable $handler) use ($storage, $dohServers, $logger, $debug) { |
|
| 217 | 217 | return new self($handler, $storage, $dohServers, $logger, $debug); |
| 218 | 218 | }; |
| 219 | 219 | } |
@@ -372,19 +372,19 @@ discard block |
||
| 372 | 372 | |
| 373 | 373 | private static function generateDnsQuery(string $domainName): string |
| 374 | 374 | { |
| 375 | - $encodedDomainName = implode('', array_map(static function (string $domainBit) { |
|
| 376 | - return \chr(\strlen($domainBit)) . $domainBit; |
|
| 375 | + $encodedDomainName = implode('', array_map(static function(string $domainBit) { |
|
| 376 | + return \chr(\strlen($domainBit)).$domainBit; |
|
| 377 | 377 | }, explode('.', $domainName))); |
| 378 | 378 | |
| 379 | 379 | return "\xab\xcd" |
| 380 | - . \chr(1) . \chr(0) |
|
| 381 | - . \chr(0) . \chr(1) // qdc |
|
| 382 | - . \chr(0) . \chr(0) // anc |
|
| 383 | - . \chr(0) . \chr(0) // nsc |
|
| 384 | - . \chr(0) . \chr(0) // arc |
|
| 385 | - . $encodedDomainName . \chr(0) // domain name |
|
| 386 | - . \chr(0) . \chr(ResourceTypes::A) // resource type |
|
| 387 | - . \chr(0) . \chr(1); // qclass |
|
| 380 | + . \chr(1).\chr(0) |
|
| 381 | + . \chr(0).\chr(1) // qdc |
|
| 382 | + . \chr(0).\chr(0) // anc |
|
| 383 | + . \chr(0).\chr(0) // nsc |
|
| 384 | + . \chr(0).\chr(0) // arc |
|
| 385 | + . $encodedDomainName.\chr(0) // domain name |
|
| 386 | + . \chr(0).\chr(ResourceTypes::A) // resource type |
|
| 387 | + . \chr(0).\chr(1); // qclass |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | private static function encodeRequest(string $request): string |