Merge branch 'master' of https://github.com/owncloud/core
This commit is contained in:
commit
be9a5dc316
|
@ -0,0 +1,16 @@
|
||||||
|
Copyright 2012-2013 Rackspace US, Inc.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
All contributions to this repository are covered under the same license,
|
||||||
|
terms, and conditions.
|
|
@ -0,0 +1,296 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Copyright (c) 2004-2013 Fabien Potencier
|
||||||
|
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights
|
||||||
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
// copies of the Software, and to permit persons to whom the Software is furnished
|
||||||
|
// to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
|
||||||
|
class ClassLoader
|
||||||
|
{
|
||||||
|
private $namespaces = array();
|
||||||
|
private $prefixes = array();
|
||||||
|
private $namespaceFallbacks = array();
|
||||||
|
private $prefixFallbacks = array();
|
||||||
|
private $useIncludePath = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on searching the include for class files. Allows easy loading
|
||||||
|
* of installed PEAR packages
|
||||||
|
*
|
||||||
|
* @param Boolean $useIncludePath
|
||||||
|
*/
|
||||||
|
public function useIncludePath($useIncludePath)
|
||||||
|
{
|
||||||
|
$this->useIncludePath = $useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used to check if the autoloader uses the include path to check
|
||||||
|
* for classes.
|
||||||
|
*
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
public function getUseIncludePath()
|
||||||
|
{
|
||||||
|
return $this->useIncludePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the configured namespaces.
|
||||||
|
*
|
||||||
|
* @return array A hash with namespaces as keys and directories as values
|
||||||
|
*/
|
||||||
|
public function getNamespaces()
|
||||||
|
{
|
||||||
|
return $this->namespaces;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the configured class prefixes.
|
||||||
|
*
|
||||||
|
* @return array A hash with class prefixes as keys and directories as values
|
||||||
|
*/
|
||||||
|
public function getPrefixes()
|
||||||
|
{
|
||||||
|
return $this->prefixes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the directory(ies) to use as a fallback for namespaces.
|
||||||
|
*
|
||||||
|
* @return array An array of directories
|
||||||
|
*/
|
||||||
|
public function getNamespaceFallbacks()
|
||||||
|
{
|
||||||
|
return $this->namespaceFallbacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the directory(ies) to use as a fallback for class prefixes.
|
||||||
|
*
|
||||||
|
* @return array An array of directories
|
||||||
|
*/
|
||||||
|
public function getPrefixFallbacks()
|
||||||
|
{
|
||||||
|
return $this->prefixFallbacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers the directory to use as a fallback for namespaces.
|
||||||
|
*
|
||||||
|
* @param array $dirs An array of directories
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerNamespaceFallbacks(array $dirs)
|
||||||
|
{
|
||||||
|
$this->namespaceFallbacks = $dirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a directory to use as a fallback for namespaces.
|
||||||
|
*
|
||||||
|
* @param string $dir A directory
|
||||||
|
*/
|
||||||
|
public function registerNamespaceFallback($dir)
|
||||||
|
{
|
||||||
|
$this->namespaceFallbacks[] = $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers directories to use as a fallback for class prefixes.
|
||||||
|
*
|
||||||
|
* @param array $dirs An array of directories
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerPrefixFallbacks(array $dirs)
|
||||||
|
{
|
||||||
|
$this->prefixFallbacks = $dirs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a directory to use as a fallback for class prefixes.
|
||||||
|
*
|
||||||
|
* @param string $dir A directory
|
||||||
|
*/
|
||||||
|
public function registerPrefixFallback($dir)
|
||||||
|
{
|
||||||
|
$this->prefixFallbacks[] = $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an array of namespaces
|
||||||
|
*
|
||||||
|
* @param array $namespaces An array of namespaces (namespaces as keys and locations as values)
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerNamespaces(array $namespaces)
|
||||||
|
{
|
||||||
|
foreach ($namespaces as $namespace => $locations) {
|
||||||
|
$this->namespaces[$namespace] = (array) $locations;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a namespace.
|
||||||
|
*
|
||||||
|
* @param string $namespace The namespace
|
||||||
|
* @param array|string $paths The location(s) of the namespace
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerNamespace($namespace, $paths)
|
||||||
|
{
|
||||||
|
$this->namespaces[$namespace] = (array) $paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers an array of classes using the PEAR naming convention.
|
||||||
|
*
|
||||||
|
* @param array $classes An array of classes (prefixes as keys and locations as values)
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerPrefixes(array $classes)
|
||||||
|
{
|
||||||
|
foreach ($classes as $prefix => $locations) {
|
||||||
|
$this->prefixes[$prefix] = (array) $locations;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers a set of classes using the PEAR naming convention.
|
||||||
|
*
|
||||||
|
* @param string $prefix The classes prefix
|
||||||
|
* @param array|string $paths The location(s) of the classes
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function registerPrefix($prefix, $paths)
|
||||||
|
{
|
||||||
|
$this->prefixes[$prefix] = (array) $paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registers this instance as an autoloader.
|
||||||
|
*
|
||||||
|
* @param Boolean $prepend Whether to prepend the autoloader or not
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
public function register($prepend = false)
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix for certain versions of PHP that have trouble with
|
||||||
|
* namespaces with leading separators.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @param mixed $className
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function makeBackwardsCompatible($className)
|
||||||
|
{
|
||||||
|
return (phpversion() < '5.3.3') ? ltrim($className, '\\') : $className;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given class or interface.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return Boolean|null True, if loaded
|
||||||
|
*/
|
||||||
|
public function loadClass($class)
|
||||||
|
{
|
||||||
|
$class = $this->makeBackwardsCompatible($class);
|
||||||
|
|
||||||
|
if ($file = $this->findFile($class)) {
|
||||||
|
require $file;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the path to the file where the class is defined.
|
||||||
|
*
|
||||||
|
* @param string $class The name of the class
|
||||||
|
*
|
||||||
|
* @return string|null The path, if found
|
||||||
|
*/
|
||||||
|
public function findFile($class)
|
||||||
|
{
|
||||||
|
if (false !== $pos = strrpos($class, '\\')) {
|
||||||
|
// namespaced class name
|
||||||
|
$namespace = substr($class, 0, $pos);
|
||||||
|
$className = substr($class, $pos + 1);
|
||||||
|
$normalizedClass = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
|
||||||
|
foreach ($this->namespaces as $ns => $dirs) {
|
||||||
|
if (0 !== strpos($namespace, $ns)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
$file = $dir.DIRECTORY_SEPARATOR.$normalizedClass;
|
||||||
|
if (is_file($file)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->namespaceFallbacks as $dir) {
|
||||||
|
$file = $dir.DIRECTORY_SEPARATOR.$normalizedClass;
|
||||||
|
if (is_file($file)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// PEAR-like class name
|
||||||
|
$normalizedClass = str_replace('_', DIRECTORY_SEPARATOR, $class).'.php';
|
||||||
|
foreach ($this->prefixes as $prefix => $dirs) {
|
||||||
|
if (0 !== strpos($class, $prefix)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
$file = $dir.DIRECTORY_SEPARATOR.$normalizedClass;
|
||||||
|
if (is_file($file)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->prefixFallbacks as $dir) {
|
||||||
|
$file = $dir.DIRECTORY_SEPARATOR.$normalizedClass;
|
||||||
|
if (is_file($file)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->useIncludePath && $file = stream_resolve_include_path($normalizedClass)) {
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,301 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright 2012-2013 Rackspace Hosting, Inc.
|
||||||
|
* See COPYING for licensing information
|
||||||
|
* @package phpOpenCloud
|
||||||
|
* @version 1.0
|
||||||
|
* @author Glen Campbell <glen.campbell@rackspace.com>
|
||||||
|
* @author Jamie Hannaford <jamie.hannaford@rackspace.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OpenCloud\Common;
|
||||||
|
|
||||||
|
use OpenCloud\Common\Lang;
|
||||||
|
use OpenCloud\Common\Exceptions\AttributeError;
|
||||||
|
use OpenCloud\Common\Exceptions\JsonError;
|
||||||
|
use OpenCloud\Common\Exceptions\UrlError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The root class for all other objects used or defined by this SDK.
|
||||||
|
*
|
||||||
|
* It contains common code for error handling as well as service functions that
|
||||||
|
* are useful. Because it is an abstract class, it cannot be called directly,
|
||||||
|
* and it has no publicly-visible properties.
|
||||||
|
*/
|
||||||
|
abstract class Base
|
||||||
|
{
|
||||||
|
|
||||||
|
private $http_headers = array();
|
||||||
|
private $_errors = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug status.
|
||||||
|
*
|
||||||
|
* @var LoggerInterface
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private $logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Logger object.
|
||||||
|
*
|
||||||
|
* @param \OpenCloud\Common\Log\LoggerInterface $logger
|
||||||
|
*/
|
||||||
|
public function setLogger(Log\LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
$this->logger = $logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Logger object.
|
||||||
|
*
|
||||||
|
* @return \OpenCloud\Common\Log\AbstractLogger
|
||||||
|
*/
|
||||||
|
public function getLogger()
|
||||||
|
{
|
||||||
|
if (null === $this->logger) {
|
||||||
|
$this->setLogger(new Log\Logger);
|
||||||
|
}
|
||||||
|
return $this->logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the URL of the service/object
|
||||||
|
*
|
||||||
|
* The assumption is that nearly all objects will have a URL; at this
|
||||||
|
* base level, it simply throws an exception to enforce the idea that
|
||||||
|
* subclasses need to define this method.
|
||||||
|
*
|
||||||
|
* @throws UrlError
|
||||||
|
*/
|
||||||
|
public function url($subresource = '')
|
||||||
|
{
|
||||||
|
throw new UrlError(Lang::translate(
|
||||||
|
'URL method must be overridden in class definition'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Populates the current object based on an unknown data type.
|
||||||
|
*
|
||||||
|
* @param array|object|string|integer $info
|
||||||
|
* @throws Exceptions\InvalidArgumentError
|
||||||
|
*/
|
||||||
|
public function populate($info, $setObjects = true)
|
||||||
|
{
|
||||||
|
if (is_string($info) || is_integer($info)) {
|
||||||
|
|
||||||
|
// If the data type represents an ID, the primary key is set
|
||||||
|
// and we retrieve the full resource from the API
|
||||||
|
$this->{$this->primaryKeyField()} = (string) $info;
|
||||||
|
$this->refresh($info);
|
||||||
|
|
||||||
|
} elseif (is_object($info) || is_array($info)) {
|
||||||
|
|
||||||
|
foreach($info as $key => $value) {
|
||||||
|
|
||||||
|
if ($key == 'metadata' || $key == 'meta') {
|
||||||
|
|
||||||
|
if (empty($this->metadata) || !$this->metadata instanceof Metadata) {
|
||||||
|
$this->metadata = new Metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Metadata
|
||||||
|
$this->$key->setArray($value);
|
||||||
|
|
||||||
|
} elseif (!empty($this->associatedResources[$key]) && $setObjects === true) {
|
||||||
|
|
||||||
|
// Associated resource
|
||||||
|
try {
|
||||||
|
$resource = $this->service()->resource($this->associatedResources[$key], $value);
|
||||||
|
$resource->setParent($this);
|
||||||
|
$this->$key = $resource;
|
||||||
|
} catch (Exception\ServiceException $e) {}
|
||||||
|
|
||||||
|
} elseif (!empty($this->associatedCollections[$key]) && $setObjects === true) {
|
||||||
|
|
||||||
|
// Associated collection
|
||||||
|
try {
|
||||||
|
$this->$key = $this->service()->resourceList($this->associatedCollections[$key], null, $this);
|
||||||
|
} catch (Exception\ServiceException $e) {}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Normal key/value pair
|
||||||
|
$this->$key = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif (null !== $info) {
|
||||||
|
throw new Exceptions\InvalidArgumentError(sprintf(
|
||||||
|
Lang::translate('Argument for [%s] must be string or object'),
|
||||||
|
get_class()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets extended attributes on an object and validates them
|
||||||
|
*
|
||||||
|
* This function is provided to ensure that attributes cannot
|
||||||
|
* arbitrarily added to an object. If this function is called, it
|
||||||
|
* means that the attribute is not defined on the object, and thus
|
||||||
|
* an exception is thrown.
|
||||||
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*
|
||||||
|
* @param string $property the name of the attribute
|
||||||
|
* @param mixed $value the value of the attribute
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __set($property, $value)
|
||||||
|
{
|
||||||
|
$this->setProperty($property, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an extended (unrecognized) property on the current object
|
||||||
|
*
|
||||||
|
* If RAXSDK_STRICT_PROPERTY_CHECKS is TRUE, then the prefix of the
|
||||||
|
* property name must appear in the $prefixes array, or else an
|
||||||
|
* exception is thrown.
|
||||||
|
*
|
||||||
|
* @param string $property the property name
|
||||||
|
* @param mixed $value the value of the property
|
||||||
|
* @param array $prefixes optional list of supported prefixes
|
||||||
|
* @throws \OpenCloud\AttributeError if strict checks are on and
|
||||||
|
* the property prefix is not in the list of prefixes.
|
||||||
|
*/
|
||||||
|
public function setProperty($property, $value, array $prefixes = array())
|
||||||
|
{
|
||||||
|
// if strict checks are off, go ahead and set it
|
||||||
|
if (!RAXSDK_STRICT_PROPERTY_CHECKS
|
||||||
|
|| $this->checkAttributePrefix($property, $prefixes)
|
||||||
|
) {
|
||||||
|
$this->$property = $value;
|
||||||
|
} else {
|
||||||
|
// if that fails, then throw the exception
|
||||||
|
throw new AttributeError(sprintf(
|
||||||
|
Lang::translate('Unrecognized attribute [%s] for [%s]'),
|
||||||
|
$property,
|
||||||
|
get_class($this)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an array of key/value pairs into a single query string
|
||||||
|
*
|
||||||
|
* For example, array('A'=>1,'B'=>2) would become 'A=1&B=2'.
|
||||||
|
*
|
||||||
|
* @param array $arr array of key/value pairs
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function makeQueryString($array)
|
||||||
|
{
|
||||||
|
$queryString = '';
|
||||||
|
|
||||||
|
foreach($array as $key => $value) {
|
||||||
|
if ($queryString) {
|
||||||
|
$queryString .= '&';
|
||||||
|
}
|
||||||
|
$queryString .= urlencode($key) . '=' . urlencode($this->to_string($value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $queryString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the most recent JSON operation for errors
|
||||||
|
*
|
||||||
|
* This function should be called after any `json_*()` function call.
|
||||||
|
* This ensures that nasty JSON errors are detected and the proper
|
||||||
|
* exception thrown.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* `$obj = json_decode($string);`
|
||||||
|
* `if (check_json_error()) do something ...`
|
||||||
|
*
|
||||||
|
* @return boolean TRUE if an error occurred, FALSE if none
|
||||||
|
* @throws JsonError
|
||||||
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
|
public function checkJsonError()
|
||||||
|
{
|
||||||
|
switch (json_last_error()) {
|
||||||
|
case JSON_ERROR_NONE:
|
||||||
|
return;
|
||||||
|
case JSON_ERROR_DEPTH:
|
||||||
|
$jsonError = 'JSON error: The maximum stack depth has been exceeded';
|
||||||
|
break;
|
||||||
|
case JSON_ERROR_STATE_MISMATCH:
|
||||||
|
$jsonError = 'JSON error: Invalid or malformed JSON';
|
||||||
|
break;
|
||||||
|
case JSON_ERROR_CTRL_CHAR:
|
||||||
|
$jsonError = 'JSON error: Control character error, possibly incorrectly encoded';
|
||||||
|
break;
|
||||||
|
case JSON_ERROR_SYNTAX:
|
||||||
|
$jsonError = 'JSON error: Syntax error';
|
||||||
|
break;
|
||||||
|
case JSON_ERROR_UTF8:
|
||||||
|
$jsonError = 'JSON error: Malformed UTF-8 characters, possibly incorrectly encoded';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$jsonError = 'Unexpected JSON error';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($jsonError)) {
|
||||||
|
throw new JsonError(Lang::translate($jsonError));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a class that implements the HttpRequest interface.
|
||||||
|
*
|
||||||
|
* This can be stubbed out for unit testing and avoid making live calls.
|
||||||
|
*/
|
||||||
|
public function getHttpRequestObject($url, $method = 'GET', array $options = array())
|
||||||
|
{
|
||||||
|
return new Request\Curl($url, $method, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the attribute $property and only permits it if the prefix is
|
||||||
|
* in the specified $prefixes array
|
||||||
|
*
|
||||||
|
* This is to support extension namespaces in some services.
|
||||||
|
*
|
||||||
|
* @param string $property the name of the attribute
|
||||||
|
* @param array $prefixes a list of prefixes
|
||||||
|
* @return boolean TRUE if valid; FALSE if not
|
||||||
|
*/
|
||||||
|
private function checkAttributePrefix($property, array $prefixes = array())
|
||||||
|
{
|
||||||
|
$prefix = strstr($property, ':', true);
|
||||||
|
|
||||||
|
if (in_array($prefix, $prefixes)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a value to an HTTP-displayable string form
|
||||||
|
*
|
||||||
|
* @param mixed $x a value to convert
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function to_string($x)
|
||||||
|
{
|
||||||
|
if (is_bool($x) && $x) {
|
||||||
|
return 'True';
|
||||||
|
} elseif (is_bool($x)) {
|
||||||
|
return 'False';
|
||||||
|
} else {
|
||||||
|
return (string) $x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
320
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Collection.php
vendored
Normal file
320
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Collection.php
vendored
Normal file
|
@ -0,0 +1,320 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides an abstraction for working with ordered sets of objects
|
||||||
|
*
|
||||||
|
* Collection objects are used whenever there are multiples; for example,
|
||||||
|
* multiple objects in a container, or multiple servers in a service.
|
||||||
|
*
|
||||||
|
* @since 1.0
|
||||||
|
* @author Glen Campbell <glen.campbell@rackspace.com>
|
||||||
|
* @author Jamie Hannaford <jamie.hannaford@rackspace.com>
|
||||||
|
*/
|
||||||
|
class Collection extends Base
|
||||||
|
{
|
||||||
|
|
||||||
|
private $service;
|
||||||
|
private $itemclass;
|
||||||
|
private $itemlist = array();
|
||||||
|
private $pointer = 0;
|
||||||
|
private $sortkey;
|
||||||
|
private $next_page_class;
|
||||||
|
private $next_page_callback;
|
||||||
|
private $next_page_url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Collection is an array of objects
|
||||||
|
*
|
||||||
|
* Some assumptions:
|
||||||
|
* * The `Collection` class assumes that there exists on its service
|
||||||
|
* a factory method with the same name of the class. For example, if
|
||||||
|
* you create a Collection of class `Foobar`, it will attempt to call
|
||||||
|
* the method `parent::Foobar()` to create instances of that class.
|
||||||
|
* * It assumes that the factory method can take an array of values, and
|
||||||
|
* it passes that to the method.
|
||||||
|
*
|
||||||
|
* @param Service $service - the service associated with the collection
|
||||||
|
* @param string $itemclass - the Class of each item in the collection
|
||||||
|
* (assumed to be the name of the factory method)
|
||||||
|
* @param array $arr - the input array
|
||||||
|
*/
|
||||||
|
public function __construct($service, $itemclass, $array)
|
||||||
|
{
|
||||||
|
$this->service = $service;
|
||||||
|
|
||||||
|
$this->getLogger()->info(
|
||||||
|
'Collection:service={class}, class={itemClass}, array={array}',
|
||||||
|
array(
|
||||||
|
'class' => get_class($service),
|
||||||
|
'itemClass' => $itemclass,
|
||||||
|
'array' => print_r($array, true)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->next_page_class = $itemclass;
|
||||||
|
|
||||||
|
if (false !== ($classNamePos = strrpos($itemclass, '\\'))) {
|
||||||
|
$this->itemclass = substr($itemclass, $classNamePos + 1);
|
||||||
|
} else {
|
||||||
|
$this->itemclass = $itemclass;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_array($array)) {
|
||||||
|
throw new Exceptions\CollectionError(
|
||||||
|
Lang::translate('Cannot create a Collection without an array')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// save the array of items
|
||||||
|
$this->setItemList($array);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the entire data array.
|
||||||
|
*
|
||||||
|
* @param array $array
|
||||||
|
*/
|
||||||
|
public function setItemList(array $array)
|
||||||
|
{
|
||||||
|
$this->itemlist = $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the entire data array.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getItemList()
|
||||||
|
{
|
||||||
|
return $this->itemlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of items in the collection
|
||||||
|
*
|
||||||
|
* For most services, this is the total number of items. If the Collection
|
||||||
|
* is paginated, however, this only returns the count of items in the
|
||||||
|
* current page of data.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function count()
|
||||||
|
{
|
||||||
|
return count($this->itemlist);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pseudonym for count()
|
||||||
|
*
|
||||||
|
* @codeCoverageIgnore
|
||||||
|
*/
|
||||||
|
public function size()
|
||||||
|
{
|
||||||
|
return $this->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the service associated with the Collection
|
||||||
|
*
|
||||||
|
* @return Service
|
||||||
|
*/
|
||||||
|
public function service()
|
||||||
|
{
|
||||||
|
return $this->service;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the pointer to the beginning, but does NOT return the first item
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function reset()
|
||||||
|
{
|
||||||
|
$this->pointer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the collection pointer back to the first item in the page
|
||||||
|
* and returns it
|
||||||
|
*
|
||||||
|
* This is useful if you're only interested in the first item in the page.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return Base the first item in the set
|
||||||
|
*/
|
||||||
|
public function first()
|
||||||
|
{
|
||||||
|
$this->reset();
|
||||||
|
return $this->next();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the next item in the page
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return Base the next item or FALSE if at the end of the page
|
||||||
|
*/
|
||||||
|
public function next()
|
||||||
|
{
|
||||||
|
if ($this->pointer >= $this->count()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$service = $this->service();
|
||||||
|
|
||||||
|
if (method_exists($service, $this->itemclass)) {
|
||||||
|
return $service->{$this->itemclass}($this->itemlist[$this->pointer++]);
|
||||||
|
} elseif (method_exists($service, 'resource')) {
|
||||||
|
return $service->resource($this->itemclass, $this->itemlist[$this->pointer++]);
|
||||||
|
}
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
|
return false;
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sorts the collection on a specified key
|
||||||
|
*
|
||||||
|
* Note: only top-level keys can be used as the sort key. Note that this
|
||||||
|
* only sorts the data in the current page of the Collection (for
|
||||||
|
* multi-page data).
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param string $keyname the name of the field to use as the sort key
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function sort($keyname = 'id')
|
||||||
|
{
|
||||||
|
$this->sortkey = $keyname;
|
||||||
|
usort($this->itemlist, array($this, 'sortCompare'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* selects only specified items from the Collection
|
||||||
|
*
|
||||||
|
* This provides a simple form of filtering on Collections. For each item
|
||||||
|
* in the collection, it calls the callback function, passing it the item.
|
||||||
|
* If the callback returns `TRUE`, then the item is retained; if it returns
|
||||||
|
* `FALSE`, then the item is deleted from the collection.
|
||||||
|
*
|
||||||
|
* Note that this should not supersede server-side filtering; the
|
||||||
|
* `Collection::Select()` method requires that *all* of the data for the
|
||||||
|
* Collection be retrieved from the server before the filtering is
|
||||||
|
* performed; this can be very inefficient, especially for large data
|
||||||
|
* sets. This method is mostly useful on smaller-sized sets.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* <code>
|
||||||
|
* $services = $connection->ServiceList();
|
||||||
|
* $services->Select(function($item){ return $item->region=='ORD';});
|
||||||
|
* // now the $services Collection only has items from the ORD region
|
||||||
|
* </code>
|
||||||
|
*
|
||||||
|
* `Select()` is *destructive*; that is, it actually removes entries from
|
||||||
|
* the collection. For example, if you use `Select()` to find items with
|
||||||
|
* the ID > 10, then use it again to find items that are <= 10, it will
|
||||||
|
* return an empty list.
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @param callable $testfunc a callback function that is passed each item
|
||||||
|
* in turn. Note that `Select()` performs an explicit test for
|
||||||
|
* `FALSE`, so functions like `strpos()` need to be cast into a
|
||||||
|
* boolean value (and not just return the integer).
|
||||||
|
* @returns void
|
||||||
|
* @throws DomainError if callback doesn't return a boolean value
|
||||||
|
*/
|
||||||
|
public function select($testfunc)
|
||||||
|
{
|
||||||
|
foreach ($this->getItemList() as $index => $item) {
|
||||||
|
$test = call_user_func($testfunc, $item);
|
||||||
|
if (!is_bool($test)) {
|
||||||
|
throw new Exceptions\DomainError(
|
||||||
|
Lang::translate('Callback function for Collection::Select() did not return boolean')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ($test === false) {
|
||||||
|
unset($this->itemlist[$index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the Collection object for the next page of results, or
|
||||||
|
* FALSE if there are no more pages
|
||||||
|
*
|
||||||
|
* Generally, the structure for a multi-page collection will look like
|
||||||
|
* this:
|
||||||
|
*
|
||||||
|
* $coll = $obj->Collection();
|
||||||
|
* do {
|
||||||
|
* while($item = $coll->Next()) {
|
||||||
|
* // do something with the item
|
||||||
|
* }
|
||||||
|
* } while ($coll = $coll->NextPage());
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
* @return Collection if there are more pages of results, otherwise FALSE
|
||||||
|
*/
|
||||||
|
public function nextPage()
|
||||||
|
{
|
||||||
|
if (isset($this->next_page_url)) {
|
||||||
|
return call_user_func(
|
||||||
|
$this->next_page_callback,
|
||||||
|
$this->next_page_class,
|
||||||
|
$this->next_page_url
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// @codeCoverageIgnoreStart
|
||||||
|
return false;
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* for paginated collection, sets the callback function and URL for
|
||||||
|
* the next page
|
||||||
|
*
|
||||||
|
* The callback function should have the signature:
|
||||||
|
*
|
||||||
|
* function Whatever($class, $url, $parent)
|
||||||
|
*
|
||||||
|
* and the `$url` should be the URL of the next page of results
|
||||||
|
*
|
||||||
|
* @param callable $callback the name of the function (or array of
|
||||||
|
* object, function name)
|
||||||
|
* @param string $url the URL of the next page of results
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setNextPageCallback($callback, $url)
|
||||||
|
{
|
||||||
|
$this->next_page_callback = $callback;
|
||||||
|
$this->next_page_url = $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares two values of sort keys
|
||||||
|
*/
|
||||||
|
private function sortCompare($a, $b)
|
||||||
|
{
|
||||||
|
$key = $this->sortkey;
|
||||||
|
|
||||||
|
// handle strings with strcmp()
|
||||||
|
if (is_string($a->$key)) {
|
||||||
|
return strcmp($a->$key, $b->$key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// handle others with logical comparisons
|
||||||
|
if ($a->$key == $b->$key) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($a->$key < $b->$key) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/AsyncError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/AsyncError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class AsyncError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class AsyncHttpError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class AsyncTimeoutError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class AttributeError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class AuthenticationError extends \Exception {}
|
7
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/BaseException.php
vendored
Normal file
7
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/BaseException.php
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class BaseException extends \Exception
|
||||||
|
{
|
||||||
|
}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/CdnError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/CdnError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class CdnError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/CdnHttpError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/CdnHttpError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class CdnHttpError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class CdnNotAvailableError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/CdnTtlError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/CdnTtlError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class CdnTtlError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class CollectionError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ContainerCreateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ContainerDeleteError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ContainerError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ContainerNameError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ContainerNotEmptyError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ContainerNotFoundError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/CreateError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/CreateError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class CreateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class CreateUpdateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class CredentialError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class DatabaseCreateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class DatabaseDeleteError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class DatabaseListError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class DatabaseNameError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class DatabaseUpdateError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/DeleteError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/DeleteError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class DeleteError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/DocumentError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/DocumentError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class DocumentError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/DomainError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/DomainError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class DomainError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class EmptyResponseError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/EndpointError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/EndpointError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class EndpointError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/FlavorError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/FlavorError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class FlavorError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/HttpError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/HttpError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class HttpError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class HttpForbiddenError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class HttpOverLimitError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class HttpRetryError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class HttpTimeoutError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class HttpUnauthorizedError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/HttpUrlError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/HttpUrlError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class HttpUrlError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/IOError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/IOError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class IOError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class IdRequiredError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/ImageError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/ImageError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ImageError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InstanceCreateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InstanceDeleteError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/InstanceError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/InstanceError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InstanceError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InstanceFlavorError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InstanceNotFound extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InstanceUpdateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InvalidArgumentError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InvalidIdTypeError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InvalidIpTypeError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InvalidParameterError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class InvalidRequestError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/JsonError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/JsonError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class JsonError extends \Exception {}
|
16
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/LoggingException.php
vendored
Normal file
16
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/LoggingException.php
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright 2012-2013 Rackspace US, Inc.
|
||||||
|
See COPYING for licensing information.
|
||||||
|
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache 2.0
|
||||||
|
* @version 1.5.9
|
||||||
|
* @author Jamie Hannaford <jamie.hannaford@rackspace.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class LoggingException extends Exception
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class MetadataCreateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class MetadataDeleteError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/MetadataError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/MetadataError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class MetadataError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class MetadataJsonError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class MetadataKeyError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class MetadataPrefixError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class MetadataUpdateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class MisMatchedChecksumError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class MissingValueError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/NameError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/NameError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class NameError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class NetworkCreateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class NetworkDeleteError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/NetworkError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/NetworkError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class NetworkError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class NetworkUpdateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class NetworkUrlError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class NoContentTypeError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/NoNameError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/NoNameError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class NoNameError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/ObjFetchError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/ObjFetchError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ObjFetchError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ObjectCopyError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/ObjectError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/ObjectError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ObjectError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/RebuildError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/RebuildError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class RebuildError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class RecordTypeError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ServerActionError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ServerCreateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ServerDeleteError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ServerImageScheduleError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ServerIpsError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ServerJsonError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ServerUpdateError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ServerUrlError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class ServiceValueError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/SnapshotError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/SnapshotError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class SnapshotError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class TempUrlMethodError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/UnknownError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/UnknownError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class UnknownError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class UnknownParameterError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class UnrecognizedServiceError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class UnsupportedExtensionError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class UnsupportedFeatureExtension extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class UnsupportedVersionError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/UpdateError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/UpdateError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class UpdateError extends \Exception {}
|
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/UrlError.php
vendored
Normal file
5
apps/files_external/3rdparty/php-opencloud/lib/OpenCloud/Common/Exceptions/UrlError.php
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class UrlError extends \Exception {}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace OpenCloud\Common\Exceptions;
|
||||||
|
|
||||||
|
class UserCreateError extends \Exception {}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue