From 24bb5fefbdf93ce0969b7f56cc46c459ebb82a95 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Thu, 14 Apr 2016 16:24:44 +0200 Subject: Mise a jour et nettoyage depot --- .../common/src/Common/Api/Operation.php | 134 --------------------- 1 file changed, 134 deletions(-) delete mode 100644 server/vendor/php-opencloud/common/src/Common/Api/Operation.php (limited to 'server/vendor/php-opencloud/common/src/Common/Api/Operation.php') diff --git a/server/vendor/php-opencloud/common/src/Common/Api/Operation.php b/server/vendor/php-opencloud/common/src/Common/Api/Operation.php deleted file mode 100644 index 927af5a..0000000 --- a/server/vendor/php-opencloud/common/src/Common/Api/Operation.php +++ /dev/null @@ -1,134 +0,0 @@ -method = $definition['method']; - $this->path = $definition['path']; - - if (isset($definition['jsonKey'])) { - $this->jsonKey = $definition['jsonKey']; - } - - $this->params = self::toParamArray($definition['params']); - } - - /** - * @return string - */ - public function getPath(): string - { - return $this->path; - } - - /** - * @return string - */ - public function getMethod(): string - { - return $this->method; - } - - /** - * Indicates whether this operation supports a parameter. - * - * @param $key The name of a parameter - * - * @return bool - */ - public function hasParam(string $key): bool - { - return isset($this->params[$key]); - } - - /** - * @param $name - * - * @return Parameter - */ - public function getParam(string $name) - { - return isset($this->params[$name]) ? $this->params[$name] : null; - } - - /** - * @return string - */ - public function getJsonKey(): string - { - return $this->jsonKey ?: ''; - } - - /** - * A convenience method that will take a generic array of data and convert it into an array of - * {@see Parameter} objects. - * - * @param array $data A generic data array - * - * @return array - */ - public static function toParamArray(array $data): array - { - $params = []; - - foreach ($data as $name => $param) { - $params[$name] = new Parameter($param + ['name' => $name]); - } - - return $params; - } - - /** - * This method will validate all of the user-provided values and throw an exception if any - * failures are detected. This is useful for basic sanity-checking before a request is - * serialized and sent to the API. - * - * @param array $userValues The user-defined values - * - * @return bool TRUE if validation passes - * @throws \Exception If validate fails - */ - public function validate(array $userValues): bool - { - foreach ($this->params as $paramName => $param) { - if (array_key_exists($paramName, $userValues)) { - $param->validate($userValues[$paramName]); - } elseif ($param->isRequired()) { - throw new \Exception(sprintf('"%s" is a required option, but it was not provided', $paramName)); - } - } - - return true; - } -} \ No newline at end of file -- cgit v1.2.3