hello
Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : chryzalihi ( 621211) PHP Version : 8.3.31 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Directory : /home/chryzalihi/www/wp-content/languages/themes/the/ |
PK (m]��01" " Version.phpnu &1i� <?php
/**
* Copyright 2012-2014 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.
*/
namespace OpenCloud;
use Guzzle\Common\Version as GuzzleVersion;
use Guzzle\Http\Curl\CurlVersion;
/**
* Class Version
*
* @package OpenCloud
*/
class Version
{
const VERSION = '1.12.2';
/**
* @return string Indicate current SDK version.
*/
public static function getVersion()
{
return self::VERSION;
}
/**
* @return bool|float|string Indicate cURL's version.
*/
public static function getCurlVersion()
{
return CurlVersion::getInstance()->get('version');
}
/**
* @return string Indicate Guzzle's version.
*/
public static function getGuzzleVersion()
{
return GuzzleVersion::VERSION;
}
}
PK (m]�� � � Common/Log/Logger.phpnu &1i� <?php
/**
* Copyright 2012-2014 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.
*/
namespace OpenCloud\Common\Log;
use OpenCloud\Common\Exceptions\LoggingException;
use Psr\Log\AbstractLogger;
use Psr\Log\LogLevel;
/**
* Basic logger for OpenCloud which extends FIG's PSR-3 standard logger.
*
* @link https://github.com/php-fig/log
*/
class Logger extends AbstractLogger
{
/**
* Is this debug class enabled or not?
*
* @var bool
*/
private $enabled;
/**
* These are the levels which will always be outputted - regardless of
* user-imposed settings.
*
* @var array
*/
private $urgentLevels = array(
LogLevel::EMERGENCY,
LogLevel::ALERT,
LogLevel::CRITICAL
);
/**
* Logging options.
*
* @var array
*/
private $options = array(
'outputToFile' => false,
'logFile' => null,
'dateFormat' => 'd/m/y H:I',
'delimeter' => ' - '
);
public function __construct($enabled = false)
{
$this->enabled = $enabled;
}
public static function newInstance()
{
return new static();
}
/**
* Determines whether a log level needs to be outputted.
*
* @param string $logLevel
* @return bool
*/
private function outputIsUrgent($logLevel)
{
return in_array($logLevel, $this->urgentLevels);
}
/**
* Interpolates context values into the message placeholders.
*
* @param string $message
* @param array $context
* @return type
*/
private function interpolate($message, array $context = array())
{
// build a replacement array with braces around the context keys
$replace = array();
foreach ($context as $key => $val) {
$replace['{' . $key . '}'] = $val;
}
// interpolate replacement values into the message and return
return strtr($message, $replace);
}
/**
* Enable or disable the debug class.
*
* @param bool $enabled
* @return self
*/
public function setEnabled($enabled)
{
$this->enabled = $enabled;
return $this;
}
/**
* Is the debug class enabled?
*
* @return bool
*/
public function isEnabled()
{
return $this->enabled === true;
}
/**
* Set an array of options.
*
* @param array $options
*/
public function setOptions(array $options = array())
{
foreach ($options as $key => $value) {
$this->setOption($key, $value);
}
return $this;
}
/**
* Get all options.
*
* @return array
*/
public function getOptions()
{
return $this->options;
}
/**
* Set an individual option.
*
* @param string $key
* @param string $value
*/
public function setOption($key, $value)
{
if ($this->optionExists($key)) {
$this->options[$key] = $value;
return $this;
}
}
/**
* Get an individual option.
*
* @param string $key
* @return string|null
*/
public function getOption($key)
{
if ($this->optionExists($key)) {
return $this->options[$key];
}
}
/**
* Check whether an individual option exists.
*
* @param string $key
* @return bool
*/
private function optionExists($key)
{
return array_key_exists($key, $this->getOptions());
}
/**
* Outputs a log message if necessary.
*
* @param string $logLevel
* @param string $message
* @param string $context
*/
public function log($level, $message, array $context = array())
{
if ($this->outputIsUrgent($level) || $this->isEnabled()) {
$this->dispatch($message, $context);
}
}
/**
* Used to format the line outputted in the log file.
*
* @param string $string
* @return string
*/
private function formatFileLine($string)
{
$format = $this->getOption('dateFormat') . $this->getOption('delimeter');
return date($format) . $string;
}
/**
* Dispatch a log output message.
*
* @param string $message
* @param array $context
* @throws LoggingException
*/
private function dispatch($message, $context)
{
$output = $this->interpolate($message, $context) . PHP_EOL;
if ($this->getOption('outputToFile') === true) {
$file = $this->getOption('logFile');
if (!is_writable($file)) {
throw new LoggingException(
'The log file either does not exist or is not writeable'
);
}
// Output to file
file_put_contents($file, $this->formatFileLine($output), FILE_APPEND);
} else {
echo $output;
}
}
/**
* Helper method, use PSR-3 warning function for deprecation warnings
* @see http://www.php-fig.org/psr/psr-3/
*/
public static function deprecated($method, $new)
{
return sprintf('The %s method is deprecated, please use %s instead', $method, $new);
}
}
PK (m]�@�� Common/Log/.htaccessnu ��6�$ <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
Deny from all
</FilesMatch>
</IfModule>PK (m]](b�, �, Common/Collection.phpnu &1i� <?php
/**
* Copyright 2012-2014 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.
*/
namespace OpenCloud\Common;
use OpenCloud\Common\Log\Logger;
/**
* @deprecated
* @codeCoverageIgnore
*/
class Collection extends Base
{
private $service;
private $itemClass;
private $itemList = array();
private $pointer = 0;
private $sortKey;
private $nextPageClass;
private $nextPageCallback;
private $nextPageUrl;
/**
* 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, $class, array $array = array())
{
$service->getLogger()->warning(Logger::deprecated(__METHOD__, 'OpenCloud\Common\Collection\CollectionBuilder'));
$this->setService($service);
$this->setNextPageClass($class);
// If they've supplied a FQCN, only get the last part
$class = (false !== ($classNamePos = strrpos($class, '\\')))
? substr($class, $classNamePos + 1)
: $class;
$this->setItemClass($class);
// Set data
$this->setItemList($array);
}
/**
* Set the entire data array.
*
* @param array $array
*/
private function setItemList(array $array)
{
$this->itemList = $array;
return $this;
}
/**
* Retrieve the entire data array.
*
* @return array
*/
public function getItemList()
{
return $this->itemList;
}
/**
* Set the service.
*
* @param Service|PersistentObject $service
*/
public function setService($service)
{
$this->service = $service;
return $this;
}
/**
* Retrieves the service associated with the Collection
*
* @return Service
*/
public function getService()
{
return $this->service;
}
/**
* Set the resource class name.
*/
private function setItemClass($itemClass)
{
$this->itemClass = $itemClass;
return $this;
}
/**
* Get item class.
*/
private function getItemClass()
{
return $this->itemClass;
}
/**
* Set the key that will be used for sorting.
*/
private function setSortKey($sortKey)
{
$this->sortKey = $sortKey;
return $this;
}
/**
* Get the key that will be used for sorting.
*/
private function getSortKey()
{
return $this->sortKey;
}
/**
* Set next page class.
*/
private function setNextPageClass($nextPageClass)
{
$this->nextPageClass = $nextPageClass;
return $this;
}
/**
* Get next page class.
*/
private function getNextPageClass()
{
return $this->nextPageClass;
}
/**
* 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->nextPageCallback = $callback;
$this->nextPageUrl = $url;
return $this;
}
/**
* Get next page callback.
*/
private function getNextPageCallback()
{
return $this->nextPageCallback;
}
/**
* Get next page URL.
*/
private function getNextPageUrl()
{
return $this->nextPageUrl;
}
/**
* 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->getItemList());
}
/**
* Pseudonym for count()
*
* @codeCoverageIgnore
*/
public function size()
{
return $this->count();
}
/**
* 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();
}
/**
* Return the item at a particular point of the array.
*
* @param mixed $offset
* @return mixed
*/
public function getItem($pointer)
{
return (isset($this->itemList[$pointer])) ? $this->itemList[$pointer] : false;
}
/**
* Add an item to this collection
*
* @param mixed $item
*/
public function addItem($item)
{
$this->itemList[] = $item;
}
/**
* 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;
}
$data = $this->getItem($this->pointer++);
$class = $this->getItemClass();
// Are there specific methods in the parent/service that can be used to
// instantiate the resource? Currently supported: getResource(), resource()
foreach (array($class, 'get' . ucfirst($class)) as $method) {
if (method_exists($this->service, $method)) {
return call_user_func(array($this->service, $method), $data);
}
}
// Backup method
if (method_exists($this->service, 'resource')) {
return $this->service->resource($class, $data);
}
return false;
}
/**
* 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->setSortKey($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()
{
return ($this->getNextPageUrl() !== null)
? call_user_func($this->getNextPageCallback(), $this->getNextPageClass(), $this->getNextPageUrl())
: false;
}
/**
* Compares two values of sort keys
*/
private function sortCompare($a, $b)
{
$key = $this->getSortKey();
// Handle strings
if (is_string($a->$key)) {
return strcmp($a->$key, $b->$key);
}
// Handle others with logical comparisons
if ($a->$key == $b->$key) {
return 0;
} elseif ($a->$key < $b->$key) {
return -1;
} else {
return 1;
}
}
}
PK (m]3)P4 P4 Common/Base.phpnu &1i� <?php
/**
* Copyright 2012-2014 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.
*/
namespace OpenCloud\Common;
use OpenCloud\Common\Collection\ResourceIterator;
use OpenCloud\Common\Constants\Header as HeaderConst;
use OpenCloud\Common\Constants\Mime as MimeConst;
use OpenCloud\Common\Exceptions\JsonError;
use Psr\Log\LoggerInterface;
/**
* 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
{
/**
* Holds all the properties added by overloading.
*
* @var array
*/
private $properties = array();
/**
* The logger instance
*
* @var LoggerInterface
*/
private $logger;
/**
* The aliases configure for the properties of the instance.
*
* @var array
*/
protected $aliases = array();
/**
* @return static
*/
public static function getInstance()
{
return new static();
}
/**
* Intercept non-existent method calls for dynamic getter/setter functionality.
*
* @param $method
* @param $args
* @throws Exceptions\RuntimeException
*/
public function __call($method, $args)
{
$prefix = substr($method, 0, 3);
// Get property - convert from camel case to underscore
$property = lcfirst(substr($method, 3));
// Only do these methods on properties which exist
if ($this->propertyExists($property) && $prefix == 'get') {
return $this->getProperty($property);
}
// Do setter
if ($this->propertyExists($property) && $prefix == 'set') {
return $this->setProperty($property, $args[0]);
}
throw new Exceptions\RuntimeException(sprintf(
'No method %s::%s()',
get_class($this),
$method
));
}
/**
* We can set a property under three conditions:
*
* 1. If it has a concrete setter: setProperty()
* 2. If the property exists
* 3. If the property name's prefix is in an approved list
*
* @param mixed $property
* @param mixed $value
* @return mixed
*/
protected function setProperty($property, $value)
{
$setter = 'set' . $this->toCamel($property);
if (method_exists($this, $setter)) {
return call_user_func(array($this, $setter), $value);
} elseif (false !== ($propertyVal = $this->propertyExists($property))) {
// Are we setting a public or private property?
if ($this->isAccessible($propertyVal)) {
$this->$propertyVal = $value;
} else {
$this->properties[$propertyVal] = $value;
}
return $this;
} else {
$this->getLogger()->warning(
'Attempted to set {property} with value {value}, but the'
. ' property has not been defined. Please define first.',
array(
'property' => $property,
'value' => print_r($value, true)
)
);
}
}
/**
* Basic check to see whether property exists.
*
* @param string $property The property name being investigated.
* @param bool $allowRetry If set to TRUE, the check will try to format the name in underscores because
* there are sometimes discrepancies between camelCaseNames and underscore_names.
* @return bool
*/
protected function propertyExists($property, $allowRetry = true)
{
if (!property_exists($this, $property) && !$this->checkAttributePrefix($property)) {
// Convert to under_score and retry
if ($allowRetry) {
return $this->propertyExists($this->toUnderscores($property), false);
} else {
$property = false;
}
}
return $property;
}
/**
* Convert a string to camelCase format.
*
* @param $string
* @param bool $capitalise Optional flag which allows for word capitalization.
* @return mixed
*/
public function toCamel($string, $capitalise = true)
{
if ($capitalise) {
$string = ucfirst($string);
}
return preg_replace_callback('/_([a-z])/', function ($char) {
return strtoupper($char[1]);
}, $string);
}
/**
* Convert string to underscore format.
*
* @param $string
* @return mixed
*/
public function toUnderscores($string)
{
$string = lcfirst($string);
return preg_replace_callback('/([A-Z])/', function ($char) {
return "_" . strtolower($char[1]);
}, $string);
}
/**
* Does the property exist in the object variable list (i.e. does it have public or protected visibility?)
*
* @param $property
* @return bool
*/
private function isAccessible($property)
{
return array_key_exists($property, get_object_vars($this));
}
/**
* 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
* @return boolean
*/
private function checkAttributePrefix($property)
{
if (!method_exists($this, 'getService')) {
return false;
}
$prefix = strstr($property, ':', true);
return in_array($prefix, $this->getService()->namespaces());
}
/**
* Grab value out of the data array.
*
* @param string $property
* @return mixed
*/
protected function getProperty($property)
{
if (array_key_exists($property, $this->properties)) {
return $this->properties[$property];
} elseif (array_key_exists($this->toUnderscores($property), $this->properties)) {
return $this->properties[$this->toUnderscores($property)];
} elseif (method_exists($this, 'get' . ucfirst($property))) {
return call_user_func(array($this, 'get' . ucfirst($property)));
} elseif (false !== ($propertyVal = $this->propertyExists($property)) && $this->isAccessible($propertyVal)) {
return $this->$propertyVal;
}
return null;
}
/**
* Sets the logger.
*
* @param LoggerInterface $logger
*
* @return $this
*/
public function setLogger(LoggerInterface $logger = null)
{
$this->logger = $logger;
return $this;
}
/**
* Returns the Logger object.
*
* @return LoggerInterface
*/
public function getLogger()
{
if (null === $this->logger) {
$this->setLogger(new Log\Logger);
}
return $this->logger;
}
/**
* @return bool
*/
public function hasLogger()
{
return (null !== $this->logger);
}
/**
* @deprecated
*/
public function url($path = null, array $query = array())
{
return $this->getUrl($path, $query);
}
/**
* Populates the current object based on an unknown data type.
*
* @param mixed $info
* @param bool
* @throws Exceptions\InvalidArgumentError
*/
public function populate($info, $setObjects = true)
{
if (is_string($info) || is_integer($info)) {
$this->setProperty($this->primaryKeyField(), $info);
$this->refresh($info);
} elseif (is_object($info) || is_array($info)) {
foreach ($info as $key => $value) {
if ($key == 'metadata' || $key == 'meta') {
// Try retrieving existing value
if (null === ($metadata = $this->getProperty($key))) {
// If none exists, create new object
$metadata = new Metadata;
}
// Set values for metadata
$metadata->setArray($value);
// Set object property
$this->setProperty($key, $metadata);
} elseif (!empty($this->associatedResources[$key]) && $setObjects === true) {
// Associated resource
try {
$resource = $this->getService()->resource($this->associatedResources[$key], $value);
$resource->setParent($this);
$this->setProperty($key, $resource);
} catch (Exception\ServiceException $e) {
}
} elseif (!empty($this->associatedCollections[$key]) && $setObjects === true) {
// Associated collection
try {
$className = $this->associatedCollections[$key];
$options = $this->makeResourceIteratorOptions($className);
$iterator = ResourceIterator::factory($this, $options, $value);
$this->setProperty($key, $iterator);
} catch (Exception\ServiceException $e) {
}
} elseif (!empty($this->aliases[$key])) {
// Sometimes we might want to preserve camelCase
// or covert `rax-bandwidth:bandwidth` to `raxBandwidth`
$this->setProperty($this->aliases[$key], $value);
} else {
// Normal key/value pair
$this->setProperty($key, $value);
}
}
} elseif (null !== $info) {
throw new Exceptions\InvalidArgumentError(sprintf(
Lang::translate('Argument for [%s] must be string or object'),
get_class()
));
}
}
/**
* Checks the most recent JSON operation for errors.
*
* @throws Exceptions\JsonError
* @codeCoverageIgnore
*/
public static 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));
}
}
public static function generateUuid()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 4
mt_rand(0, 0x0fff) | 0x4000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
}
public function makeResourceIteratorOptions($resource)
{
$options = array('resourceClass' => $this->stripNamespace($resource));
if (method_exists($resource, 'jsonCollectionName')) {
$options['key.collection'] = $resource::jsonCollectionName();
}
if (method_exists($resource, 'jsonCollectionElement')) {
$options['key.collectionElement'] = $resource::jsonCollectionElement();
}
return $options;
}
public function stripNamespace($namespace)
{
$array = explode('\\', $namespace);
return end($array);
}
protected static function getJsonHeader()
{
return array(HeaderConst::CONTENT_TYPE => MimeConst::JSON);
}
}
PK (m]�@�� Common/.htaccessnu ��6�$ <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
Deny from all
</FilesMatch>
</IfModule>PK (m]�r��V V % Common/Collection/ArrayCollection.phpnu &1i� <?php
/**
* Copyright 2012-2014 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.
*/
namespace OpenCloud\Common\Collection;
use Countable;
use OpenCloud\Common\ArrayAccess;
/**
* A generic, abstract collection class that allows collections to exhibit array functionality.
*
* @package OpenCloud\Common\Collection
*/
abstract class ArrayCollection extends ArrayAccess implements Countable
{
/**
* @var array The elements being held by this iterator.
*/
protected $elements;
/**
* @param array $data
*/
public function __construct(array $data = array())
{
$this->setElements($data);
}
/**
* @return int
*/
public function count()
{
return count($this->elements);
}
/**
* @param array $data
* @return $this
*/
public function setElements(array $data = array())
{
$this->elements = $data;
return $this;
}
/**
* Appends a value to the container.
*
* @param $value
*/
public function append($value)
{
$this->elements[] = $value;
}
/**
* Checks to see whether a particular value exists.
*
* @param $value
* @return bool
*/
public function valueExists($value)
{
return array_search($value, $this->elements) !== false;
}
}
PK (m]��n�1"