Add sub namespace for plugins
This commit is contained in:
47
app/Core/Plugin/Base.php
Normal file
47
app/Core/Plugin/Base.php
Normal 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user