From eba1008d4eb925e83eb2346e39552a1896a330b9 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 17 Dec 2016 19:35:46 +0100 Subject: [PATCH] add project to middlewares --- ipf/middleware/base.php | 13 ++++++++++--- ipf/project.php | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ipf/middleware/base.php b/ipf/middleware/base.php index 39731a7..7449207 100644 --- a/ipf/middleware/base.php +++ b/ipf/middleware/base.php @@ -2,12 +2,20 @@ class IPF_Middleware { - protected $next, $settings; + /** @var IPF_Middleware */ + protected $next; - function __construct($next, $settings) + /** @var IPF_Settings */ + protected $settings; + + /** @var IPF_Project */ + protected $project; + + function __construct(IPF_Middleware $next, IPF_Settings $settings, IPF_Project $project) { $this->next = $next; $this->settings = $settings; + $this->project = $project; } function processRequest($request) @@ -34,4 +42,3 @@ class IPF_Middleware return $this->processResponse($request, $response); } } - diff --git a/ipf/project.php b/ipf/project.php index 4da1fae..6ca989e 100644 --- a/ipf/project.php +++ b/ipf/project.php @@ -46,7 +46,7 @@ final class IPF_Project $m = null; foreach (array_reverse($middlewares) as $mw) { - $m = new $mw($m, IPF::$settings); + $m = new $mw($m, IPF::$settings, $this); } return $m; } -- 2.49.0