Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?PHP
- /**
- * ILLI
- *
- * @package ILLI
- * @link http://illi.be
- * @license http://l.illi.be
- * @copyright ILLI Conference
- */
- NAMESPACE ILLI\Base;
- USE ILLI\Base\tBase AS tBase;
- USE ILLI\Base\Component\Delegate\Hook\tAdapter AS tAdapter;
- USE ILLI\Base\Component\Delegate\Hook\tSignal AS tSignal;
- /**
- * Property Base...
- *
- * @package ILLI
- * @subpackage Base
- * @link http://illi.be
- * @license http://l.illi.be
- * @copyright ILLI Conference
- */
- ABSTRACT CLASS aBase
- {
- use tBase;
- USE tAdapter
- {
- Base_Component_Delegate_Hook_tAdapter_defineInvoke as public defineAdapterInvoke;
- Base_Component_Delegate_Hook_tAdapter_defineDelegate as public defineAdapterDelegate;
- }
- USE tSignal
- {
- Base_Component_Delegate_Hook_tSignal_defineInvoke as public defineSignalInvoke;
- Base_Component_Delegate_Hook_tSignal_defineDelegate as public defineSignalDelegate;
- }
- ### USE tFilter ... // stub
- ### USE tObserver ... // stub
- protected $__runtimeConfig = [];
- protected $__defaultConfig = [];
- protected $__autoConfig = [];
- /**
- * @discuss final constructor with protected construct-event
- * @see construct()
- */
- final public function __construct(array $__options = [])
- {
- $defaults =
- [
- '__init' => TRUE,
- '__signal' => [
- __METHOD__ => [
- 'PRE_EVENT' => [], // delegate 1, delegate 2, ...
- 'POST_EVENT' => [] // delegate 1, delegate 2, ...
- ],
- ],
- '__observer' =>
- [
- __METHOD__ => [] // delegate 1, delegate 2, ...
- ],
- '__filter' =>
- [
- __METHOD__ => [] // delegate 1, delegate 2, ...
- ],
- '__adapter' =>
- [
- __METHOD__ => NULL // delegate
- ]
- ];
- // reference from protected to private scope
- $this->__Base_tBase_runtimeConfig =& $this->__runtimeConfig;
- // copy from protected into private scope
- $this->__Base_tBase_autoConfig = $this->__autoConfig;
- $this->__Base_tBase_defaultConfig = $this->__defaultConfig;
- $this->__Base_tBase_initConfig = $__options + $defaults;
- if(TRUE === $this->__Base_tBase_initConfig['__init'])
- {
- // load runtime args
- $this->Base_tBase_init();
- // register signals
- foreach($this->__Base_tBase_initConfig['__signal'] as $method => $events)
- foreach($events as $event => $hook)
- foreach($hook as $slotIdent => $delegate)
- $this->defineSignalInvoke($method, $event, $slotIdent, $delegate, FALSE);
- foreach($this->__Base_tBase_initConfig['__observer'] as $methodEvent => $observers)
- foreach($observers as $delegate); // stub
- ### $this->defineObserverInvoke($methodEvent, $delegate, FALSE);
- foreach($this->__Base_tBase_initConfig['__adapter'] as $method => $adapter)
- $this->defineAdapterInvoke($method, $adapter, FALSE);
- foreach($this->__Base_tBase_initConfig['__filter'] as $method => $filters)
- foreach($filters as $filter); // stub
- ### $this->defineFilterInvoke($method, $filter, FALSE);
- // execute PRE_EVENT
- $this->Base_Component_Delegate_Hook_tSignal_emit(__Method__, 'PRE_EVENT', [$this->__runtimeConfig]);
- // additional
- $this->construct();
- // filter result
- ### $filtered = $this->Base_Component_Delegate_Hook_tFilter_emit(__Method__, [$this->__runtimeConfig]);
- $filtered = $this->__runtimeConfig; // stub
- // observer notify with filtered result
- ### $this->Base_Component_Delegate_Hook_tObserver_emit(__Method__, $filtered);
- // execute POST_EVENT
- $this->Base_Component_Delegate_Hook_tSignal_emit(__Method__, 'POST_EVENT', [$filtered]);
- }
- }
- /**
- * construct-event instead of __construct()-overwrites
- */
- protected function construct()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement