summaryrefslogtreecommitdiff
path: root/server/vendor/php-opencloud/common/src/Common/Api
diff options
context:
space:
mode:
Diffstat (limited to 'server/vendor/php-opencloud/common/src/Common/Api')
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php12
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php20
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php2
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Api/Operation.php22
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Api/Operator.php18
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php11
-rwxr-xr-xserver/vendor/php-opencloud/common/src/Common/Api/Parameter.php48
7 files changed, 68 insertions, 65 deletions
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php b/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php
index beee5e8..09988fd 100755
--- a/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php
+++ b/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types = 1);
namespace OpenCloud\Common\Api;
@@ -6,27 +6,27 @@ abstract class AbstractApi implements ApiInterface
{
protected $params;
- protected function isRequired(array $param)
+ protected function isRequired(array $param): array
{
return array_merge($param, ['required' => true]);
}
- protected function notRequired(array $param)
+ protected function notRequired(array $param): array
{
return array_merge($param, ['required' => false]);
}
- protected function query(array $param)
+ protected function query(array $param): array
{
return array_merge($param, ['location' => AbstractParams::QUERY]);
}
- protected function url(array $param)
+ protected function url(array $param): array
{
return array_merge($param, ['location' => AbstractParams::URL]);
}
- public function documented(array $param)
+ public function documented(array $param): array
{
return array_merge($param, ['required' => true]);
}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php b/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php
index 225e025..b21b3dd 100755
--- a/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php
+++ b/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Api;
@@ -21,12 +21,12 @@ abstract class AbstractParams
const INT_TYPE = 'integer';
const INTEGER_TYPE = self::INT_TYPE;
- public static function isSupportedLocation($val)
+ public static function isSupportedLocation(string $val): bool
{
return in_array($val, [self::QUERY, self::HEADER, self::URL, self::JSON, self::RAW]);
}
- public function limit()
+ public function limit(): array
{
return [
'type' => self::INT_TYPE,
@@ -38,7 +38,7 @@ DESC
];
}
- public function marker()
+ public function marker(): array
{
return [
'type' => 'string',
@@ -51,7 +51,7 @@ DESC
];
}
- public function id($type)
+ public function id(string $type): array
{
return [
'description' => sprintf("The unique ID, or identifier, for the %s", $type),
@@ -60,7 +60,7 @@ DESC
];
}
- public function idPath()
+ public function idPath(): array
{
return [
'type' => self::STRING_TYPE,
@@ -69,7 +69,7 @@ DESC
];
}
- public function name($resource)
+ public function name(string $resource): array
{
return [
'description' => sprintf("The name of the %s", $resource),
@@ -79,7 +79,7 @@ DESC
}
- public function sortDir()
+ public function sortDir(): array
{
return [
'type' => self::STRING_TYPE,
@@ -89,7 +89,7 @@ DESC
];
}
- public function sortKey()
+ public function sortKey(): array
{
return [
'type' => self::STRING_TYPE,
@@ -97,4 +97,4 @@ DESC
'description' => "Sorts by one or more sets of attribute and sort direction combinations.",
];
}
-}
+} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php b/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php
index d5d26a0..d4629dc 100755
--- a/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php
+++ b/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Api;
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/Operation.php b/server/vendor/php-opencloud/common/src/Common/Api/Operation.php
index 3155ca4..927af5a 100755
--- a/server/vendor/php-opencloud/common/src/Common/Api/Operation.php
+++ b/server/vendor/php-opencloud/common/src/Common/Api/Operation.php
@@ -1,9 +1,7 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Api;
-use GuzzleHttp\Utils;
-
/**
* This class represents an OpenCloud API operation. It encapsulates most aspects of the REST operation: its HTTP
* method, the URL path, its top-level JSON key, and all of its {@see Parameter} objects.
@@ -49,7 +47,7 @@ class Operation
/**
* @return string
*/
- public function getPath()
+ public function getPath(): string
{
return $this->path;
}
@@ -57,7 +55,7 @@ class Operation
/**
* @return string
*/
- public function getMethod()
+ public function getMethod(): string
{
return $this->method;
}
@@ -69,7 +67,7 @@ class Operation
*
* @return bool
*/
- public function hasParam($key)
+ public function hasParam(string $key): bool
{
return isset($this->params[$key]);
}
@@ -79,7 +77,7 @@ class Operation
*
* @return Parameter
*/
- public function getParam($name)
+ public function getParam(string $name)
{
return isset($this->params[$name]) ? $this->params[$name] : null;
}
@@ -87,9 +85,9 @@ class Operation
/**
* @return string
*/
- public function getJsonKey()
+ public function getJsonKey(): string
{
- return $this->jsonKey;
+ return $this->jsonKey ?: '';
}
/**
@@ -100,7 +98,7 @@ class Operation
*
* @return array
*/
- public static function toParamArray(array $data)
+ public static function toParamArray(array $data): array
{
$params = [];
@@ -121,7 +119,7 @@ class Operation
* @return bool TRUE if validation passes
* @throws \Exception If validate fails
*/
- public function validate(array $userValues)
+ public function validate(array $userValues): bool
{
foreach ($this->params as $paramName => $param) {
if (array_key_exists($paramName, $userValues)) {
@@ -133,4 +131,4 @@ class Operation
return true;
}
-}
+} \ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/Operator.php b/server/vendor/php-opencloud/common/src/Common/Api/Operator.php
index 4325b69..5698779 100755
--- a/server/vendor/php-opencloud/common/src/Common/Api/Operator.php
+++ b/server/vendor/php-opencloud/common/src/Common/Api/Operator.php
@@ -1,7 +1,9 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Api;
+use GuzzleHttp\Promise\PromiseInterface;
+use GuzzleHttp\Psr7\Uri;
use function GuzzleHttp\uri_template;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Promise\Promise;
@@ -60,12 +62,12 @@ abstract class Operator implements OperatorInterface
*
* @return Operation
*/
- public function getOperation(array $definition)
+ public function getOperation(array $definition): Operation
{
return new Operation($definition);
}
- protected function sendRequest(Operation $operation, array $userValues = [], $async = false)
+ protected function sendRequest(Operation $operation, array $userValues = [], bool $async = false)
{
$operation->validate($userValues);
@@ -79,7 +81,7 @@ abstract class Operator implements OperatorInterface
/**
* {@inheritDoc}
*/
- public function execute(array $definition, array $userValues = [])
+ public function execute(array $definition, array $userValues = []): ResponseInterface
{
return $this->sendRequest($this->getOperation($definition), $userValues);
}
@@ -87,7 +89,7 @@ abstract class Operator implements OperatorInterface
/**
* {@inheritDoc}
*/
- public function executeAsync(array $definition, array $userValues = [])
+ public function executeAsync(array $definition, array $userValues = []): PromiseInterface
{
return $this->sendRequest($this->getOperation($definition), $userValues, true);
}
@@ -95,7 +97,7 @@ abstract class Operator implements OperatorInterface
/**
* {@inheritDoc}
*/
- public function model($class, $data = null)
+ public function model(string $class, $data = null): ResourceInterface
{
$model = new $class($this->client, $this->api);
@@ -121,13 +123,13 @@ abstract class Operator implements OperatorInterface
*
* @return static
*/
- public function newInstance()
+ public function newInstance(): self
{
return new static($this->client, $this->api);
}
/**
- * @return \GuzzleHttp\Psr7\Uri
+ * @return \GuzzleHttp\Psr7\Uri:null
*/
protected function getHttpBaseUrl()
{
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php b/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php
index 43c6ce2..168518b 100755
--- a/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php
+++ b/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php
@@ -1,8 +1,11 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Api;
use GuzzleHttp\ClientInterface;
+use GuzzleHttp\Promise\PromiseInterface;
+use OpenCloud\Common\Resource\ResourceInterface;
+use Psr\Http\Message\ResponseInterface;
/**
* An operator is any resource or service that can invoke and send REST operations. In other words, it
@@ -28,7 +31,7 @@ interface OperatorInterface
*
* @return \Psr\Http\Message\ResponseInterface
*/
- public function execute(array $definition, array $userValues = []);
+ public function execute(array $definition, array $userValues = []): ResponseInterface;
/**
* A convenience method that assembles an operation and asynchronously sends it to the remote API
@@ -38,7 +41,7 @@ interface OperatorInterface
*
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function executeAsync(array $definition, array $userValues = []);
+ public function executeAsync(array $definition, array $userValues = []): PromiseInterface;
/**
* @param string $name The name of the model class.
@@ -47,5 +50,5 @@ interface OperatorInterface
*
* @return \OpenCloud\Common\Resource\ResourceInterface
*/
- public function model($name, $data = null);
+ public function model(string $name, $data = null): ResourceInterface;
}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/Parameter.php b/server/vendor/php-opencloud/common/src/Common/Api/Parameter.php
index 97330a4..f1ec7c7 100755
--- a/server/vendor/php-opencloud/common/src/Common/Api/Parameter.php
+++ b/server/vendor/php-opencloud/common/src/Common/Api/Parameter.php
@@ -1,4 +1,4 @@
-<?php
+<?php declare(strict_types=1);
namespace OpenCloud\Common\Api;
@@ -42,7 +42,7 @@ class Parameter
*
* @var string
*/
- private $name;
+ private $name = '';
/**
* The alias for this parameter. Although the user will always interact with the human-friendly $name property,
@@ -50,7 +50,7 @@ class Parameter
*
* @var string
*/
- private $sentAs;
+ private $sentAs = '';
/**
* For array parameters (for example, an array of security group names when creating a server), each array element
@@ -79,7 +79,7 @@ class Parameter
*
* @var string
*/
- private $type;
+ private $type = '';
/**
* Indicates whether this parameter requires a value from the user.
@@ -94,7 +94,7 @@ class Parameter
*
* @var string
*/
- private $location;
+ private $location = '';
/**
* Relevant to "json" location parameters only. This property allows for deep nesting through the use of
@@ -102,14 +102,14 @@ class Parameter
*
* @var string
*/
- private $path;
+ private $path = '';
/**
* Allows for the prefixing of parameter names.
*
* @var string
*/
- private $prefix;
+ private $prefix = '';
/**
* The enum values for which this param is restricted.
@@ -151,7 +151,7 @@ class Parameter
private function stockProperties(array $data)
{
if (isset($data['properties'])) {
- if (stripos($this->name, 'metadata') !== false) {
+ if ($this->name && stripos($this->name, 'metadata') !== false) {
$this->properties = new Parameter($data['properties']);
} else {
foreach ($data['properties'] as $name => $property) {
@@ -166,7 +166,7 @@ class Parameter
*
* @return string
*/
- public function getName()
+ public function getName(): string
{
return $this->sentAs ?: $this->name;
}
@@ -176,7 +176,7 @@ class Parameter
*
* @return bool
*/
- public function isRequired()
+ public function isRequired(): bool
{
return $this->required === true;
}
@@ -189,7 +189,7 @@ class Parameter
* @return bool TRUE if the validation passes
* @throws \Exception If validation fails
*/
- public function validate($userValues)
+ public function validate($userValues): bool
{
$this->validateEnums($userValues);
$this->validateType($userValues);
@@ -245,9 +245,9 @@ class Parameter
* @returns Parameter
* @throws \Exception
*/
- private function getNestedProperty($key)
+ private function getNestedProperty($key): Parameter
{
- if (stripos($this->name, 'metadata') !== false && $this->properties instanceof Parameter) {
+ if ($this->name && stripos($this->name, 'metadata') !== false && $this->properties instanceof Parameter) {
return $this->properties;
} elseif (isset($this->properties[$key])) {
return $this->properties[$key];
@@ -264,7 +264,7 @@ class Parameter
*
* @return bool
*/
- private function hasCorrectType($userValue)
+ private function hasCorrectType($userValue): bool
{
// Helper fn to see whether an array is associative (i.e. a JSON object)
$isAssociative = function ($value) {
@@ -293,7 +293,7 @@ class Parameter
*
* @return bool
*/
- public function isArray()
+ public function isArray(): bool
{
return $this->type == 'array' && $this->itemSchema instanceof Parameter;
}
@@ -303,12 +303,12 @@ class Parameter
*
* @return bool
*/
- public function isObject()
+ public function isObject(): bool
{
return $this->type == 'object' && !empty($this->properties);
}
- public function getLocation()
+ public function getLocation(): string
{
return $this->location;
}
@@ -320,7 +320,7 @@ class Parameter
*
* @return bool
*/
- public function hasLocation($value)
+ public function hasLocation($value): bool
{
return $this->location == $value;
}
@@ -330,7 +330,7 @@ class Parameter
*
* @return string|null
*/
- public function getPath()
+ public function getPath(): string
{
return $this->path;
}
@@ -338,7 +338,7 @@ class Parameter
/**
* Retrieves the common schema that an array parameter applies to all its child elements.
*
- * @return Parameter
+ * @return Parameter|null
*/
public function getItemSchema()
{
@@ -350,7 +350,7 @@ class Parameter
*
* @param string $name
*/
- public function setName($name)
+ public function setName(string $name)
{
$this->name = $name;
}
@@ -362,7 +362,7 @@ class Parameter
*
* @return null|Parameter
*/
- public function getProperty($name)
+ public function getProperty(string $name)
{
if ($this->properties instanceof Parameter) {
$this->properties->setName($name);
@@ -377,12 +377,12 @@ class Parameter
*
* @return string|null
*/
- public function getPrefix()
+ public function getPrefix(): string
{
return $this->prefix;
}
- public function getPrefixedName()
+ public function getPrefixedName(): string
{
return $this->prefix . $this->getName();
}