Add sub namespace for plugins

This commit is contained in:
Frederic Guillot
2015-09-20 13:11:41 -04:00
parent fe57edd9e8
commit a0124b45f9
5 changed files with 19 additions and 18 deletions

47
app/Core/Plugin/Base.php Normal file
View File

@@ -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);
});
}
}