diff options
Diffstat (limited to 'lib/private/Http')
-rw-r--r-- | lib/private/Http/Client/Client.php | 4 | ||||
-rw-r--r-- | lib/private/Http/Client/DnsPinMiddleware.php | 16 | ||||
-rw-r--r-- | lib/private/Http/Client/Response.php | 39 |
3 files changed, 12 insertions, 47 deletions
diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php index c3f8f589827..553a8921a80 100644 --- a/lib/private/Http/Client/Client.php +++ b/lib/private/Http/Client/Client.php @@ -149,8 +149,8 @@ class Client implements IClient { } private function isLocalAddressAllowed(array $options) : bool { - if (($options['nextcloud']['allow_local_address'] ?? false) || - $this->config->getSystemValueBool('allow_local_remote_servers', false)) { + if (($options['nextcloud']['allow_local_address'] ?? false) + || $this->config->getSystemValueBool('allow_local_remote_servers', false)) { return true; } diff --git a/lib/private/Http/Client/DnsPinMiddleware.php b/lib/private/Http/Client/DnsPinMiddleware.php index 630d2c8e9f1..96e0f71adbe 100644 --- a/lib/private/Http/Client/DnsPinMiddleware.php +++ b/lib/private/Http/Client/DnsPinMiddleware.php @@ -13,23 +13,15 @@ use OCP\Http\Client\LocalServerException; use Psr\Http\Message\RequestInterface; class DnsPinMiddleware { - /** @var NegativeDnsCache */ - private $negativeDnsCache; - private IpAddressClassifier $ipAddressClassifier; public function __construct( - NegativeDnsCache $negativeDnsCache, - IpAddressClassifier $ipAddressClassifier, + private NegativeDnsCache $negativeDnsCache, + private IpAddressClassifier $ipAddressClassifier, ) { - $this->negativeDnsCache = $negativeDnsCache; - $this->ipAddressClassifier = $ipAddressClassifier; } /** * Fetch soa record for a target - * - * @param string $target - * @return array|null */ private function soaRecord(string $target): ?array { $labels = explode('.', $target); @@ -99,7 +91,7 @@ class DnsPinMiddleware { return \dns_get_record($hostname, $type); } - public function addDnsPinning() { + public function addDnsPinning(): callable { return function (callable $handler) { return function ( RequestInterface $request, @@ -109,7 +101,7 @@ class DnsPinMiddleware { return $handler($request, $options); } - $hostName = (string)$request->getUri()->getHost(); + $hostName = $request->getUri()->getHost(); $port = $request->getUri()->getPort(); $ports = [ diff --git a/lib/private/Http/Client/Response.php b/lib/private/Http/Client/Response.php index adf83306d07..1e4cb3b8fa2 100644 --- a/lib/private/Http/Client/Response.php +++ b/lib/private/Http/Client/Response.php @@ -11,49 +11,25 @@ namespace OC\Http\Client; use OCP\Http\Client\IResponse; use Psr\Http\Message\ResponseInterface; -/** - * Class Response - * - * @package OC\Http - */ class Response implements IResponse { - /** @var ResponseInterface */ - private $response; - - /** - * @var bool - */ - private $stream; + private ResponseInterface $response; + private bool $stream; - /** - * @param ResponseInterface $response - * @param bool $stream - */ - public function __construct(ResponseInterface $response, $stream = false) { + public function __construct(ResponseInterface $response, bool $stream = false) { $this->response = $response; $this->stream = $stream; } - /** - * @return string|resource - */ public function getBody() { - return $this->stream ? - $this->response->getBody()->detach(): - $this->response->getBody()->getContents(); + return $this->stream + ? $this->response->getBody()->detach() + :$this->response->getBody()->getContents(); } - /** - * @return int - */ public function getStatusCode(): int { return $this->response->getStatusCode(); } - /** - * @param string $key - * @return string - */ public function getHeader(string $key): string { $headers = $this->response->getHeader($key); @@ -64,9 +40,6 @@ class Response implements IResponse { return $headers[0]; } - /** - * @return array - */ public function getHeaders(): array { return $this->response->getHeaders(); } |