Skip to content

Commit

Permalink
fixup! Cleanup middleware registering
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Jan 3, 2019
1 parent 6c6b3b4 commit 4b695a4
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions lib/private/AppFramework/DependencyInjection/DIContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
/**
* @var array
*/
private $middleWares = array();
private $middleWares = [];

/** @var ServerContainer */
private $server;
Expand Down Expand Up @@ -104,7 +104,7 @@ public function __construct($appName, $urlParams = array(), ServerContainer $ser
/**
* Core services
*/
$this->registerService(IOutput::class, function($c){
$this->registerService(IOutput::class, function(){
return new Output($this->getServer()->getWebRoot());
});

Expand All @@ -125,7 +125,7 @@ public function __construct($appName, $urlParams = array(), ServerContainer $ser
return new OC\AppFramework\Logger($this->server->query(ILogger::class), $c->query('AppName'));
});

$this->registerService(IServerContainer::class, function ($c) {
$this->registerService(IServerContainer::class, function () {
return $this->getServer();
});
$this->registerAlias('ServerContainer', IServerContainer::class);
Expand Down Expand Up @@ -181,11 +181,8 @@ public function __construct($appName, $urlParams = array(), ServerContainer $ser
/**
* Middleware
*/
$app = $this;

$middleWares = &$this->middleWares;
$this->registerService('MiddlewareDispatcher', function(SimpleContainer $c) use (&$middleWares, $app) {
$server = $app->getServer();
$this->registerService('MiddlewareDispatcher', function(SimpleContainer $c) {
$server = $this->getServer();

$dispatcher = new MiddlewareDispatcher();
$dispatcher->registerMiddleware(
Expand Down Expand Up @@ -265,7 +262,7 @@ public function __construct($appName, $urlParams = array(), ServerContainer $ser
)
);

foreach($middleWares as $middleWare) {
foreach($this->middleWares as $middleWare) {
$dispatcher->registerMiddleware($c[$middleWare]);
}

Expand Down

0 comments on commit 4b695a4

Please sign in to comment.