File: /var/www/web37/htdocs/fickanzeiger/core/DataAggregator.php
<?php
/**
* Arfooo
*
* @package Arfooo
* @copyright Copyright (c) Arfooo Annuaire (fr) and Arfooo Directory (en)
* by Guillaume Hocine (c) 2007 - 2010
* http://www.arfooo.com/ (fr) and http://www.arfooo.net/ (en)
* @author Guillaume Hocine & Adrian Galewski
* @license http://creativecommons.org/licenses/by/2.0/fr/ Creative Commons
*/
/**
* Class for storing values with arrayAccess and IteratorAggregate
*/
class DataAggregator extends Object implements ArrayAccess, IteratorAggregate
{
protected $data;
public function __construct($data = array())
{
$this->data = $data;
}
public function __get($name)
{
return $this->data[$name];
}
public function __set($name, $value)
{
$this->data[$name] = $value;
}
public function __isset($name)
{
return isset($this->data[$name]);
}
public function getIterator()
{
return new ArrayObject($this->data);
}
public function offsetExists($offset)
{
return isset($this->data[$offset]);
}
public function offsetGet($offset)
{
return $this->data[$offset];
}
public function offsetSet($offset, $value)
{
$this->__set($offset, $value);
}
public function offsetUnset($offset)
{
unset($this->data[$offset]);
}
public function toArray()
{
return $this->data;
}
public function fromArray($data)
{
$this->data = $data;
return $this;
}
}