From 54ec6723deb44e325782afd366eeec01ee29ac55 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Wed, 23 Mar 2016 15:30:47 +0100 Subject: Maj Library --- .../common/src/Common/Api/AbstractApi.php | 12 +++--- .../common/src/Common/Api/AbstractParams.php | 20 ++++----- .../common/src/Common/Api/ApiInterface.php | 2 +- .../common/src/Common/Api/Operation.php | 22 +++++----- .../common/src/Common/Api/Operator.php | 18 ++++---- .../common/src/Common/Api/OperatorInterface.php | 11 +++-- .../common/src/Common/Api/Parameter.php | 48 +++++++++++----------- 7 files changed, 68 insertions(+), 65 deletions(-) (limited to 'server/vendor/php-opencloud/common/src/Common/Api') 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 100644 --- 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 @@ - 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 100644 --- 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 @@ - 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 100644 --- 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 @@ -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 100644 --- 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 @@ -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 100644 --- 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 @@ -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(); } -- cgit v1.2.3