1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 14:30:32 +02:00

[feature/event-dispatcher] Support setting data on an event

PHPBB3-9550
This commit is contained in:
Igor Wiedler
2012-01-07 21:42:19 +01:00
parent 58a99c97ca
commit 03be976137
2 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1,56 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
class phpbb_event_data extends phpbb_event implements ArrayAccess
{
private $data;
public function __construct(array $data = array())
{
$this->set_data($data);
}
public function set_data(array $data = array())
{
$this->data = $data;
}
public function get_data()
{
return $this->data;
}
public function offsetExists($offset)
{
return isset($this->data[$offset]);
}
public function offsetGet($offset)
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}
public function offsetSet($offset, $value)
{
$this->data[$offset] = $value;
}
public function offsetUnset($offset)
{
unset($this->data[$offset]);
}
}