Refactored to 2 namespaces: Wootook & Legacies
Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
cfeb6aca6d
commit
ec7e40e1aa
1004 changed files with 4808 additions and 2971 deletions
82
application/code/core/Wootook/Object.php
Normal file
82
application/code/core/Wootook/Object.php
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Object
|
||||
implements ArrayAccess
|
||||
{
|
||||
protected $_data = array();
|
||||
|
||||
public function __construct(Array $data = array())
|
||||
{
|
||||
$this->_data = $data;
|
||||
}
|
||||
|
||||
public function getData($key)
|
||||
{
|
||||
if ($this->hasData($key)) {
|
||||
return $this->_data[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAllDatas()
|
||||
{
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
public function hasData($key)
|
||||
{
|
||||
return (bool) isset($this->_data[$key]);
|
||||
}
|
||||
|
||||
public function setData($key, $value)
|
||||
{
|
||||
$this->_data[$key] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addData(Array $data)
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$this->setData($key, $value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function unsetData($key)
|
||||
{
|
||||
if ($this->hasData($key)) {
|
||||
unset($this->_data[$key]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearData()
|
||||
{
|
||||
$this->_data = array();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return $this->hasData($offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->getData($offset);
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $data)
|
||||
{
|
||||
return $this->setData($offset, $data);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
return $this->unsetData($offset);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue