Blame view
sources/3rdparty/aws-sdk/utilities/credential.class.php
4.46 KB
|
03e52840d
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
<?php
/*
* Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
/*%******************************************************************************************%*/
// CLASS
/**
* The <CFCredential> class represents an individual credential set.
*
* @version 2011.11.15
* @license See the included NOTICE.md file for more information.
* @copyright See the included NOTICE.md file for more information.
* @link http://aws.amazon.com/php/ PHP Developer Center
*/
class CFCredential implements ArrayAccess
{
/**
* Stores the internal <php:ArrayObject> representation of the collection.
*/
private $collection;
/**
* Default getter. Enables syntax such as $object->method->chained_method();. Also supports
* $object->key. Matching methods are prioritized over matching keys.
*
* @param string $name (Required) The name of the method to execute or key to retrieve.
* @return mixed The results of calling the function <code>$name()</code>, or the value of the key <code>$object[$name]</code>.
*/
public function __get($name)
{
return $this[$name];
}
/**
* Default setter.
*
* @param string $name (Required) The name of the method to execute.
* @param string $value (Required) The value to pass to the method.
* @return mixed The results of calling the function, <code>$name</code>.
*/
public function __set($name, $value)
{
$this[$name] = $value;
return $this;
}
/**
* Create a clone of the object.
*
* @return CFCredential A clone of the current instance.
*/
public function __clone()
{
$this->collection = clone $this->collection;
}
/*%******************************************************************************************%*/
// CONSTRUCTOR
/**
* Constructs a new instance of the <CFCredential> class.
*/
public function __construct($value = array())
{
$this->collection = new ArrayObject($value, ArrayObject::ARRAY_AS_PROPS);
}
/**
* Check whether or not a specific offset exists.
*
* @param integer $offset (Required) The location in the collection to verify the existence of.
* @return boolean A value of <code>true</code> indicates that the collection offset exists. A value of <code>false</code> indicates that it does not.
*/
public function offsetExists($offset)
{
return $this->collection->offsetExists($offset);
}
/**
* Get the value for a specific offset.
*
* @param integer $offset (Required) The location in the collection to retrieve the value for.
* @return mixed The value of the collection offset. <code>NULL</code> is returned if the offset does not exist.
*/
public function offsetGet($offset)
{
if ($this->collection->offsetExists($offset))
{
return $this->collection->offsetGet($offset);
}
return null;
}
/**
* Set the value for a specific offset.
*
* @param integer $offset (Required) The location in the collection to set a new value for.
* @param mixed $value (Required) The new value for the collection location.
* @return CFCredential A reference to the current collection.
*/
public function offsetSet($offset, $value)
{
$this->collection->offsetSet($offset, $value);
return $this;
}
/**
* Unset the value for a specific offset.
*
* @param integer $offset (Required) The location in the collection to unset.
* @return CFCredential A reference to the current collection.
*/
public function offsetUnset($offset)
{
$this->collection->offsetUnset($offset);
return $this;
}
/**
* Merge another instance of <CFCredential> onto this one.
*
* @param CFCredential $credential (Required) Another instance of <CFCredential>.
* @return CFCredential A reference to the current collection.
*/
public function merge(CFCredential $credential)
{
$merged = array_merge($this->to_array(), $credential->to_array());
$this->collection->exchangeArray($merged);
return $this;
}
/**
* Retrieves the data as a standard array.
*
* @return array The data as an array.
*/
public function to_array()
{
return $this->collection->getArrayCopy();
}
}
|