Started building page cleanup Modified code pools Backported layout/blocks/templates 3-step view system Reforged Overview page Moved graphics, added topnav template, fixed number render bug Added BCMath optionnal usage Updated BC Math comparison for capped resources Fixed planet resource production updates Various additions Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
82 lines
No EOL
1.4 KiB
PHP
82 lines
No EOL
1.4 KiB
PHP
<?php
|
|
|
|
class Legacies_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);
|
|
}
|
|
} |