@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $top = count($labels) >= 2 ? array_pop($labels) : ''; |
| 30 | 30 | $second = array_pop($labels); |
| 31 | 31 | |
| 32 | - $hostname = $second . '.' . $top; |
|
| 32 | + $hostname = $second.'.'.$top; |
|
| 33 | 33 | $responses = $this->dnsGetRecord($hostname, DNS_SOA); |
| 34 | 34 | |
| 35 | 35 | if ($responses === false || count($responses) === 0) { |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * Wrapper for dns_get_record |
| 89 | 89 | */ |
| 90 | - protected function dnsGetRecord(string $hostname, int $type): array|false { |
|
| 90 | + protected function dnsGetRecord(string $hostname, int $type): array | false { |
|
| 91 | 91 | return \dns_get_record($hostname, $type); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public function addDnsPinning(): callable { |
| 95 | - return function (callable $handler) { |
|
| 96 | - return function ( |
|
| 95 | + return function(callable $handler) { |
|
| 96 | + return function( |
|
| 97 | 97 | RequestInterface $request, |
| 98 | 98 | array $options, |
| 99 | 99 | ) use ($handler) { |
@@ -110,13 +110,13 @@ discard block |
||
| 110 | 110 | ]; |
| 111 | 111 | |
| 112 | 112 | if ($port !== null) { |
| 113 | - $ports[] = (string)$port; |
|
| 113 | + $ports[] = (string) $port; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $targetIps = $this->dnsResolve(idn_to_utf8($hostName), 0); |
| 117 | 117 | |
| 118 | 118 | if (empty($targetIps)) { |
| 119 | - throw new LocalServerException('No DNS record found for ' . $hostName); |
|
| 119 | + throw new LocalServerException('No DNS record found for '.$hostName); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $curlResolves = []; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | foreach ($targetIps as $ip) { |
| 128 | 128 | if ($this->ipAddressClassifier->isLocalAddress($ip)) { |
| 129 | 129 | // TODO: continue with all non-local IPs? |
| 130 | - throw new LocalServerException('Host "' . $ip . '" (' . $hostName . ':' . $port . ') violates local access rules'); |
|
| 130 | + throw new LocalServerException('Host "'.$ip.'" ('.$hostName.':'.$port.') violates local access rules'); |
|
| 131 | 131 | } |
| 132 | 132 | $curlResolves["$hostName:$port"][] = $ip; |
| 133 | 133 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | // Coalesce the per-host:port ips back into a comma separated list |
| 137 | 137 | foreach ($curlResolves as $hostport => $ips) { |
| 138 | - $options['curl'][CURLOPT_RESOLVE][] = "$hostport:" . implode(',', $ips); |
|
| 138 | + $options['curl'][CURLOPT_RESOLVE][] = "$hostport:".implode(',', $ips); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | return $handler($request, $options); |