mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-14 02:27:23 -07:00
spaces.php
This commit is contained in:
parent
7755490b81
commit
eefa32741e
845 changed files with 50409 additions and 0 deletions
60
aws/Aws/HasDataTrait.php
Normal file
60
aws/Aws/HasDataTrait.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
namespace Aws;
|
||||
|
||||
/**
|
||||
* Trait implementing ToArrayInterface, \ArrayAccess, \Countable, and
|
||||
* \IteratorAggregate
|
||||
*/
|
||||
trait HasDataTrait
|
||||
{
|
||||
/** @var array */
|
||||
private $data = [];
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a reference to the variable to allow for indirect
|
||||
* array modification (e.g., $foo['bar']['baz'] = 'qux').
|
||||
*
|
||||
* @param $offset
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function & offsetGet($offset)
|
||||
{
|
||||
if (isset($this->data[$offset])) {
|
||||
return $this->data[$offset];
|
||||
}
|
||||
|
||||
$value = null;
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->data[$offset] = $value;
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->data[$offset]);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->data[$offset]);
|
||||
}
|
||||
|
||||
public function toArray()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
return count($this->data);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue