diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-01-07 21:42:19 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-01-07 21:42:19 +0100 |
commit | 03be9761375a082c2a43aceaa1b34661f87d702b (patch) | |
tree | c6dce9e83f0cec85f977f3b32b6c276f80f2985f /phpBB/includes/event | |
parent | 58a99c97cadd6a16b138e4de4f8fd1aa172e4eed (diff) | |
download | forums-03be9761375a082c2a43aceaa1b34661f87d702b.tar forums-03be9761375a082c2a43aceaa1b34661f87d702b.tar.gz forums-03be9761375a082c2a43aceaa1b34661f87d702b.tar.bz2 forums-03be9761375a082c2a43aceaa1b34661f87d702b.tar.xz forums-03be9761375a082c2a43aceaa1b34661f87d702b.zip |
[feature/event-dispatcher] Support setting data on an event
PHPBB3-9550
Diffstat (limited to 'phpBB/includes/event')
-rw-r--r-- | phpBB/includes/event/data.php | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/phpBB/includes/event/data.php b/phpBB/includes/event/data.php new file mode 100644 index 0000000000..754876c119 --- /dev/null +++ b/phpBB/includes/event/data.php @@ -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]); + } +} |