summaryrefslogtreecommitdiff
path: root/app/Core/Plugin/Base.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Core/Plugin/Base.php')
-rw-r--r--app/Core/Plugin/Base.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/app/Core/Plugin/Base.php b/app/Core/Plugin/Base.php
new file mode 100644
index 00000000..580d41ad
--- /dev/null
+++ b/app/Core/Plugin/Base.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Core\Plugin;
+
+/**
+ * Plugin Base class
+ *
+ * @package plugin
+ * @author Frederic Guillot
+ */
+abstract class Base extends \Core\Base
+{
+ /**
+ * Method called for each request
+ *
+ * @abstract
+ * @access public
+ */
+ abstract public function initialize();
+
+ /**
+ * Returns all classes that needs to be stored in the DI container
+ *
+ * @access public
+ * @return array
+ */
+ public function getClasses()
+ {
+ return array();
+ }
+
+ /**
+ * Listen on internal events
+ *
+ * @access public
+ * @param string $event
+ * @param callable $callback
+ */
+ public function on($event, $callback)
+ {
+ $container = $this->container;
+
+ $this->container['dispatcher']->addListener($event, function() use ($container, $callback) {
+ call_user_func($callback, $container);
+ });
+ }
+}