22
33namespace PHPPM \Bridges ;
44
5+ use PHPPM \Bootstraps \AbstractBootstrap ;
56use PHPPM \Bootstraps \BootstrapInterface ;
67use PHPPM \Bootstraps \HooksInterface ;
78use PHPPM \React \HttpResponse ;
@@ -21,7 +22,7 @@ class HttpKernel implements BridgeInterface
2122 protected $ application ;
2223
2324 /**
24- * @var BootstrapInterface
25+ * @var AbstractBootstrap
2526 */
2627 protected $ bootstrap ;
2728
@@ -71,7 +72,7 @@ public function onRequest(ReactRequest $request, HttpResponse $response)
7172 return ;
7273 }
7374
74- $ syRequest = self :: mapRequest ($ request );
75+ $ syRequest = $ this -> mapRequest ($ request );
7576
7677 //start buffering the output, so cgi is not sending any http headers
7778 //this is necessary because it would break session handling since
@@ -90,7 +91,7 @@ public function onRequest(ReactRequest $request, HttpResponse $response)
9091 throw $ exception ;
9192 }
9293
93- self :: mapResponse ($ response , $ syResponse );
94+ $ this -> mapResponse ($ response , $ syResponse );
9495
9596 if ($ this ->application instanceof TerminableInterface) {
9697 $ this ->application ->terminate ($ syRequest , $ syResponse );
@@ -107,7 +108,7 @@ public function onRequest(ReactRequest $request, HttpResponse $response)
107108 * @param ReactRequest $reactRequest
108109 * @return SymfonyRequest $syRequest
109110 */
110- protected static function mapRequest (ReactRequest $ reactRequest )
111+ protected function mapRequest (ReactRequest $ reactRequest )
111112 {
112113 $ method = $ reactRequest ->getMethod ();
113114 $ headers = array_change_key_case ($ reactRequest ->getHeaders ());
@@ -125,7 +126,9 @@ protected static function mapRequest(ReactRequest $reactRequest)
125126 $ files = $ reactRequest ->getFiles ();
126127 $ post = $ reactRequest ->getPost ();
127128
128- $ syRequest = new SymfonyRequest ($ query , $ post , $ attributes = [], $ cookies , $ files , $ _SERVER , $ reactRequest ->getBody ());
129+ $ class = $ this ->bootstrap ->requestClass ();
130+
131+ $ syRequest = new $ class ($ query , $ post , $ attributes = [], $ cookies , $ files , $ _SERVER , $ reactRequest ->getBody ());
129132
130133 $ syRequest ->setMethod ($ method );
131134 $ syRequest ->headers ->replace ($ headers );
@@ -139,7 +142,7 @@ protected static function mapRequest(ReactRequest $reactRequest)
139142 * @param HttpResponse $reactResponse
140143 * @param SymfonyResponse $syResponse
141144 */
142- protected static function mapResponse (HttpResponse $ reactResponse , SymfonyResponse $ syResponse )
145+ protected function mapResponse (HttpResponse $ reactResponse , SymfonyResponse $ syResponse )
143146 {
144147 $ content = $ syResponse ->getContent ();
145148
0 commit comments