summaryrefslogtreecommitdiff
path: root/server/vendor/php-opencloud/common/src/Common/Transport
diff options
context:
space:
mode:
Diffstat (limited to 'server/vendor/php-opencloud/common/src/Common/Transport')
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php4
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php12
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Transport/Middleware.php20
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php4
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Transport/Utils.php14
5 files changed, 28 insertions, 26 deletions
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php b/server/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php
index 7d83875..8e7b8db 100755
--- a/server/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php
+++ b/server/vendor/php-opencloud/common/src/Common/Transport/HandlerStack.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Transport;
@@ -7,7 +7,7 @@ use GuzzleHttp\HandlerStack as GuzzleStack;
class HandlerStack extends GuzzleStack
{
- public static function create(callable $handler = null)
+ public static function create(callable $handler = null): self
{
$stack = new self($handler ?: choose_handler());
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php b/server/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php
index 11b31d3..4d0b2e4 100755
--- a/server/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php
+++ b/server/vendor/php-opencloud/common/src/Common/Transport/JsonSerializer.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Transport;
@@ -22,7 +22,7 @@ class JsonSerializer
*
* @return array|mixed
*/
- private function stockValue(Parameter $param, $userValue, $json)
+ private function stockValue(Parameter $param, $userValue, array $json): array
{
$name = $param->getName();
if ($path = $param->getPath()) {
@@ -46,7 +46,7 @@ class JsonSerializer
*
* @return array|mixed
*/
- private function stockArrayJson(Parameter $param, $userValue)
+ private function stockArrayJson(Parameter $param, array $userValue): array
{
$elems = [];
foreach ($userValue as $item) {
@@ -63,7 +63,7 @@ class JsonSerializer
*
* @return array
*/
- private function stockObjectJson(Parameter $param, $userValue)
+ private function stockObjectJson(Parameter $param, \stdClass $userValue): array
{
$object = [];
foreach ($userValue as $key => $val) {
@@ -82,12 +82,12 @@ class JsonSerializer
*
* @return array
*/
- public function stockJson(Parameter $param, $userValue, $json)
+ public function stockJson(Parameter $param, $userValue, array $json): array
{
if ($param->isArray()) {
$userValue = $this->stockArrayJson($param, $userValue);
} elseif ($param->isObject()) {
- $userValue = $this->stockObjectJson($param, $userValue);
+ $userValue = $this->stockObjectJson($param, (object) $userValue);
}
// Populate the final value
return $this->stockValue($param, $userValue, $json);
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/Middleware.php b/server/vendor/php-opencloud/common/src/Common/Transport/Middleware.php
index 916ff22..2b407a4 100755
--- a/server/vendor/php-opencloud/common/src/Common/Transport/Middleware.php
+++ b/server/vendor/php-opencloud/common/src/Common/Transport/Middleware.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Transport;
@@ -9,13 +9,15 @@ use OpenCloud\Common\Auth\AuthHandler;
use OpenCloud\Common\Auth\Token;
use OpenCloud\Common\Error\Builder;
use Psr\Http\Message\ResponseInterface;
+use Psr\Log\LoggerInterface;
+use Psr\Log\LogLevel;
final class Middleware
{
/**
* @return callable
*/
- public static function httpErrors()
+ public static function httpErrors(): callable
{
return function (callable $handler) {
return function ($request, array $options) use ($handler) {
@@ -37,7 +39,7 @@ final class Middleware
*
* @return callable
*/
- public static function authHandler(callable $tokenGenerator, Token $token = null)
+ public static function authHandler(callable $tokenGenerator, Token $token = null): callable
{
return function (callable $handler) use ($tokenGenerator, $token) {
return new AuthHandler($handler, $tokenGenerator, $token);
@@ -47,7 +49,7 @@ final class Middleware
/**
* @codeCoverageIgnore
*/
- public static function history(array &$container)
+ public static function history(array &$container): callable
{
return GuzzleMiddleware::history($container);
}
@@ -55,7 +57,7 @@ final class Middleware
/**
* @codeCoverageIgnore
*/
- public static function retry(callable $decider, callable $delay = null)
+ public static function retry(callable $decider, callable $delay = null): callable
{
return GuzzleMiddleware::retry($decider, $delay);
}
@@ -63,7 +65,7 @@ final class Middleware
/**
* @codeCoverageIgnore
*/
- public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = LogLevel::INFO)
+ public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = LogLevel::INFO): callable
{
return GuzzleMiddleware::log($logger, $formatter, $logLevel);
}
@@ -71,7 +73,7 @@ final class Middleware
/**
* @codeCoverageIgnore
*/
- public static function prepareBody()
+ public static function prepareBody(): callable
{
return GuzzleMiddleware::prepareBody();
}
@@ -79,7 +81,7 @@ final class Middleware
/**
* @codeCoverageIgnore
*/
- public static function mapRequest(callable $fn)
+ public static function mapRequest(callable $fn): callable
{
return GuzzleMiddleware::mapRequest($fn);
}
@@ -87,7 +89,7 @@ final class Middleware
/**
* @codeCoverageIgnore
*/
- public static function mapResponse(callable $fn)
+ public static function mapResponse(callable $fn): callable
{
return GuzzleMiddleware::mapResponse($fn);
}
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php b/server/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php
index 30f04af..61533fb 100755
--- a/server/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php
+++ b/server/vendor/php-opencloud/common/src/Common/Transport/RequestSerializer.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Transport;
@@ -17,7 +17,7 @@ class RequestSerializer
$this->jsonSerializer = $jsonSerializer ?: new JsonSerializer();
}
- public function serializeOptions(Operation $operation, array $userValues = [])
+ public function serializeOptions(Operation $operation, array $userValues = []): array
{
$options = ['headers' => []];
diff --git a/server/vendor/php-opencloud/common/src/Common/Transport/Utils.php b/server/vendor/php-opencloud/common/src/Common/Transport/Utils.php
index c2a2dc1..ffac9ce 100755
--- a/server/vendor/php-opencloud/common/src/Common/Transport/Utils.php
+++ b/server/vendor/php-opencloud/common/src/Common/Transport/Utils.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Transport;
@@ -8,7 +8,7 @@ use Psr\Http\Message\UriInterface;
class Utils
{
- public static function jsonDecode(ResponseInterface $response, $assoc = true)
+ public static function jsonDecode(ResponseInterface $response, bool $assoc = true)
{
$jsonErrors = [
JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded',
@@ -40,11 +40,11 @@ class Utils
* Method for flattening a nested array.
*
* @param array $data The nested array
- * @param null $key The key to extract
+ * @param string $key The key to extract
*
* @return array
*/
- public static function flattenJson($data, $key = null)
+ public static function flattenJson($data, string $key = null)
{
return (!empty($data) && $key && isset($data[$key])) ? $data[$key] : $data;
}
@@ -59,7 +59,7 @@ class Utils
*
* @return string
*/
- public static function normalizeUrl($url)
+ public static function normalizeUrl(string $url): string
{
if (strpos($url, 'http') === false) {
$url = 'http://' . $url;
@@ -76,12 +76,12 @@ class Utils
*
* @return UriInterface
*/
- public static function addPaths(UriInterface $uri, ...$paths)
+ public static function addPaths(UriInterface $uri, ...$paths): UriInterface
{
return uri_for(rtrim((string) $uri, '/') . '/' . implode('/', $paths));
}
- public static function appendPath(UriInterface $uri, $path)
+ public static function appendPath(UriInterface $uri, $path): UriInterface
{
return uri_for(rtrim((string) $uri, '/') . '/' . $path);
}