Make sure all middlewares are only registered once

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2019-05-06 11:28:18 +02:00
parent 0877a2e627
commit 471827cb31
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with 3 additions and 0 deletions

View File

@ -299,6 +299,9 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @return boolean|null
*/
public function registerMiddleWare($middleWare) {
if (in_array($middleWare, $this->middleWares, true) !== false) {
return false;
}
$this->middleWares[] = $middleWare;
}