class DIContainer extends SimpleContainer implements IAppContainer{
+ /**
+ * @var array
+ */
+ private $middleWares;
/**
* Put your class dependencies in here
$dispatcher = new MiddlewareDispatcher();
$dispatcher->registerMiddleware($c['SecurityMiddleware']);
+ foreach($this->middleWares as $middleWare) {
+ $dispatcher->registerMiddleware($middleWare);
+ }
+
return $dispatcher;
});
* @return boolean
*/
function registerMiddleWare(IMiddleWare $middleWare) {
- /** @var $dispatcher MiddlewareDispatcher */
- $dispatcher = $this->query('MiddlewareDispatcher');
- $dispatcher->registerMiddleware($middleWare);
-
+ array_push($this->middleWares, $middleWare);
}
/**