aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/event
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-07-07 20:23:19 +0200
committerJoas Schilling <nickvergessen@gmx.de>2014-07-07 20:23:19 +0200
commit56a89fe0a2adbe91b32acabc3705e59d06d1e38f (patch)
tree0336e39bf0250e4acc2ebdfdf4130a1b527eaa1d /phpBB/phpbb/event
parent7118f84d2985dc3af32120f94054bf64a3bdd72a (diff)
parent29a07404d3e34fd4ec5ad1cb83992b78658808b9 (diff)
downloadforums-56a89fe0a2adbe91b32acabc3705e59d06d1e38f.tar
forums-56a89fe0a2adbe91b32acabc3705e59d06d1e38f.tar.gz
forums-56a89fe0a2adbe91b32acabc3705e59d06d1e38f.tar.bz2
forums-56a89fe0a2adbe91b32acabc3705e59d06d1e38f.tar.xz
forums-56a89fe0a2adbe91b32acabc3705e59d06d1e38f.zip
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/12782] Add doc block [ticket/12782] Use an interface for the phpbb event_dispatcher
Diffstat (limited to 'phpBB/phpbb/event')
-rw-r--r--phpBB/phpbb/event/dispatcher.php5
-rw-r--r--phpBB/phpbb/event/dispatcher_interface.php40
2 files changed, 44 insertions, 1 deletions
diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php
index 6a2f9008be..9a786022c2 100644
--- a/phpBB/phpbb/event/dispatcher.php
+++ b/phpBB/phpbb/event/dispatcher.php
@@ -29,8 +29,11 @@ use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
* extract($phpbb_dispatcher->trigger_event('core.index', compact($vars)));
*
*/
-class dispatcher extends ContainerAwareEventDispatcher
+class dispatcher extends ContainerAwareEventDispatcher implements dispatcher_interface
{
+ /**
+ * {@inheritdoc}
+ */
public function trigger_event($eventName, $data = array())
{
$event = new \phpbb\event\data($data);
diff --git a/phpBB/phpbb/event/dispatcher_interface.php b/phpBB/phpbb/event/dispatcher_interface.php
new file mode 100644
index 0000000000..50a3ef9101
--- /dev/null
+++ b/phpBB/phpbb/event/dispatcher_interface.php
@@ -0,0 +1,40 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\event;
+
+/**
+* Extension of the Symfony2 EventDispatcher
+*
+* It provides an additional `trigger_event` method, which
+* gives some syntactic sugar for dispatching events. Instead
+* of creating the event object, the method will do that for
+* you.
+*
+* Example:
+*
+* $vars = array('page_title');
+* extract($phpbb_dispatcher->trigger_event('core.index', compact($vars)));
+*
+*/
+interface dispatcher_interface extends \Symfony\Component\EventDispatcher\EventDispatcherInterface
+{
+ /**
+ * Construct and dispatch an event
+ *
+ * @param string $eventName The event name
+ * @param array $data An array containing the variables sending with the event
+ * @return mixed
+ */
+ public function trigger_event($eventName, $data = array());
+}