@@ -41,7 +41,7 @@ |
||
| 41 | 41 | if (empty($headers)) { |
| 42 | 42 | return []; |
| 43 | 43 | } |
| 44 | - return array_map(function ($enc) { |
|
| 44 | + return array_map(function($enc) { |
|
| 45 | 45 | return trim(mb_strtolower($enc)); |
| 46 | 46 | }, explode(',', $headers)); |
| 47 | 47 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | public function getHeader(string $key, ?string $default = null): ?string |
| 173 | 173 | { |
| 174 | - return isset($this->headers[$key])? strval(reset($this->headers[$key])) : $default; |
|
| 174 | + return isset($this->headers[$key]) ? strval(reset($this->headers[$key])) : $default; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function getHeaders(string $key): array |
| 182 | 182 | { |
| 183 | - return isset($this->headers[$key])? $this->headers[$key] : []; |
|
| 183 | + return isset($this->headers[$key]) ? $this->headers[$key] : []; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function addValues($array): self |
| 151 | 151 | { |
| 152 | - array_walk($array, function ($value, $key) { |
|
| 152 | + array_walk($array, function($value, $key) { |
|
| 153 | 153 | $this->addValue($key, $value); |
| 154 | 154 | }); |
| 155 | 155 | return $this; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | protected function prepareBoundary(): self |
| 229 | 229 | { |
| 230 | - $this->boundary = $this->isMultipart() ? $this->generateBoundary() : null ; |
|
| 230 | + $this->boundary = $this->isMultipart() ? $this->generateBoundary() : null; |
|
| 231 | 231 | return $this; |
| 232 | 232 | } |
| 233 | 233 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | protected function getQueryHeaders(): string |
| 349 | 349 | { |
| 350 | - return implode(Http::DELIMITER, array_map(function ($key, $value) { |
|
| 350 | + return implode(Http::DELIMITER, array_map(function($key, $value) { |
|
| 351 | 351 | return sprintf('%s: %s', $key, $value); |
| 352 | 352 | }, array_keys($this->headers), array_values($this->headers))); |
| 353 | 353 | } |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | { |
| 370 | 370 | $requestPart = ''; |
| 371 | 371 | if ($this->isInline() && !empty($this->content)) { |
| 372 | - $requestPart .= (false === mb_strpos($this->path, '?')) ? '?' : '&' ; |
|
| 372 | + $requestPart .= (false === mb_strpos($this->path, '?')) ? '?' : '&'; |
|
| 373 | 373 | $requestPart .= $this->getSimpleRequest(); |
| 374 | 374 | } |
| 375 | 375 | return $this->path . $requestPart; |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | protected function getSimpleRequest(): string |
| 383 | 383 | { |
| 384 | - return implode('&', array_map(function ($key, Http\Query\Value $value) { |
|
| 384 | + return implode('&', array_map(function($key, Http\Query\Value $value) { |
|
| 385 | 385 | return sprintf('%s=%s', urlencode($key), urlencode($value->getContent())); |
| 386 | 386 | }, array_keys($this->content), array_values($this->content))); |
| 387 | 387 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | public function getHost(): string |
| 52 | 52 | { |
| 53 | 53 | $host = '' . $this->host; |
| 54 | - return (preg_match('#^[0-9a-f:]+$#', $host) ? '[' . $host . ']' : $host ); // IPv6 |
|
| 54 | + return (preg_match('#^[0-9a-f:]+$#', $host) ? '[' . $host . ']' : $host); // IPv6 |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function getPort(): ?int |
@@ -218,7 +218,7 @@ |
||
| 218 | 218 | * @return int |
| 219 | 219 | * @link https://www.php.net/manual/en/function.stat.php |
| 220 | 220 | */ |
| 221 | - protected function parseMode(/** @scrutinizer ignore-unused */ ?Protocol\Answer\Protection $info, ?int $mode): int |
|
| 221 | + protected function parseMode(/** @scrutinizer ignore-unused */ ? Protocol\Answer\Protection $info, ?int $mode): int |
|
| 222 | 222 | { |
| 223 | 223 | switch ($mode) { |
| 224 | 224 | case Protocol::RDTYPE_DIR: |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | // ]; |
| 52 | 52 | |
| 53 | 53 | $context = stream_context_create($this->contextOptions); |
| 54 | - $link = $params->getSchema() . $params->getHost() . (!empty($params->getPort()) ? ':' . $params->getPort() : '' ); |
|
| 54 | + $link = $params->getSchema() . $params->getHost() . (!empty($params->getPort()) ? ':' . $params->getPort() : ''); |
|
| 55 | 55 | $timeout = is_null($params->getTimeout()) ? 10.0 : floatval($params->getTimeout()); // do NOT ask - php7 + phpstan |
| 56 | 56 | |
| 57 | 57 | if (!$filePointer = stream_socket_client($link, $errno, $errStr, $timeout, STREAM_CLIENT_CONNECT, $context)) { |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $this->setRRLang($lang); |
| 35 | 35 | $pointer = empty($contextOptions) |
| 36 | 36 | ? ($long ? new RemoteRequest\Sockets\PfSocket($lang) : new RemoteRequest\Sockets\FSocket($lang)) |
| 37 | - : (new RemoteRequest\Sockets\Stream($lang))->setContextOptions($contextOptions) ; |
|
| 37 | + : (new RemoteRequest\Sockets\Stream($lang))->setContextOptions($contextOptions); |
|
| 38 | 38 | $this->processor = new RemoteRequest\Connection\Processor($pointer, $lang); |
| 39 | 39 | $this->params = $this->loadParams(); |
| 40 | 40 | $this->query = $this->loadQuery(); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | ]); |
| 121 | 121 | } |
| 122 | 122 | // @codeCoverageIgnoreEnd |
| 123 | - if ($checksum != $this->headChecksum ) { |
|
| 123 | + if ($checksum != $this->headChecksum) { |
|
| 124 | 124 | throw new RequestException($this->getRRLang()->rrFspInvalidChecksum($checksum, $this->headChecksum)); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | public function getChecksumPacket(): string |
| 134 | 134 | { |
| 135 | - $content = $this->header . $this->content . $this->extra ; |
|
| 135 | + $content = $this->header . $this->content . $this->extra; |
|
| 136 | 136 | $content[1] = chr(0); // null checksum |
| 137 | 137 | return $content; |
| 138 | 138 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Helper |
| 18 | 18 | { |
| 19 | - protected static ?Interfaces\IRRTranslations $lang = null; // translations |
|
| 19 | + protected static ? Interfaces\IRRTranslations $lang = null; // translations |
|
| 20 | 20 | protected string $link = ''; // target |
| 21 | 21 | /** @var string|string[]|array<string|int, string|int> */ |
| 22 | 22 | protected $postContent = ''; // what to say to the target |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | if (false === $parsedLink) { |
| 115 | 115 | throw new RequestException(static::getLang()->rrHelpInvalidLink($this->link)); |
| 116 | 116 | } |
| 117 | - $schema = !empty($parsedLink["scheme"]) ? strtolower($parsedLink["scheme"]) : '' ; |
|
| 117 | + $schema = !empty($parsedLink["scheme"]) ? strtolower($parsedLink["scheme"]) : ''; |
|
| 118 | 118 | $libParams = $this->getFilledConnectionParams($schema, $parsedLink); |
| 119 | 119 | $libQuery = $this->getLibRequest($schema, $parsedLink, $libParams); |
| 120 | 120 | return $this->getLibResponseProcessor($schema)->setResponse( |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $query->maxLength = is_null($this->connectionParams['maxLength']) ? null : intval($this->connectionParams['maxLength']); |
| 226 | 226 | return $query |
| 227 | 227 | ->setRequestSettings($settings) |
| 228 | - ->setPath($parsed['path'] . (!empty($parsed['query']) ? '?' . $parsed['query'] : '' )) |
|
| 228 | + ->setPath($parsed['path'] . (!empty($parsed['query']) ? '?' . $parsed['query'] : '')) |
|
| 229 | 229 | ->setMethod($this->getMethod()) |
| 230 | 230 | ->setInline(boolval($this->connectionParams['multipart'])) |
| 231 | 231 | ->addValues(empty($this->postContent) ? [] : (array) $this->postContent) |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | protected function getMethod(): string |
| 239 | 239 | { |
| 240 | 240 | $method = strtoupper(strval($this->connectionParams['method'])); |
| 241 | - return (in_array($method, ['GET', 'POST', 'PUT', 'DELETE'])) ? $method : 'GET' ; |
|
| 241 | + return (in_array($method, ['GET', 'POST', 'PUT', 'DELETE'])) ? $method : 'GET'; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |