aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/event/data.php
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2013-07-13 22:47:41 -0700
committerNathan Guse <nathaniel.guse@gmail.com>2013-07-13 22:47:41 -0700
commit1e37d97909ccf52b08e2a809ea8a9365c824d8de (patch)
treea260c846cb47713e72de11cfb9803d981ea6faaf /phpBB/phpbb/event/data.php
parent4186c05bb4b97374392031a10b796e77b857afaf (diff)
parent7030578bbe9e11c18b5becaf8b06e670e3c2e3cd (diff)
downloadforums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.tar
forums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.tar.gz
forums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.tar.bz2
forums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.tar.xz
forums-1e37d97909ccf52b08e2a809ea8a9365c824d8de.zip
Merge pull request #1559 from naderman/ticket/11698
[WIP][ticket/11698] Moving all autoloadable files to phpbb/
Diffstat (limited to 'phpBB/phpbb/event/data.php')
-rw-r--r--phpBB/phpbb/event/data.php68
1 files changed, 68 insertions, 0 deletions
diff --git a/phpBB/phpbb/event/data.php b/phpBB/phpbb/event/data.php
new file mode 100644
index 0000000000..70718ff0ae
--- /dev/null
+++ b/phpBB/phpbb/event/data.php
@@ -0,0 +1,68 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+use Symfony\Component\EventDispatcher\Event;
+
+class phpbb_event_data extends 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;
+ }
+
+ /**
+ * Returns data filtered to only include specified keys.
+ *
+ * This effectively discards any keys added to data by hooks.
+ */
+ public function get_data_filtered($keys)
+ {
+ return array_intersect_key($this->data, array_flip($keys));
+ }
+
+ 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]);
+ }
+}