@@ -18,7 +18,7 @@ class HttpKernel implements BridgeInterface
18
18
/**
19
19
* An application implementing the HttpKernelInterface
20
20
*
21
- * @var \Symfony\Component\HttpFoundation \HttpKernelInterface
21
+ * @var \Symfony\Component\HttpKernel \HttpKernelInterface
22
22
*/
23
23
protected $ application ;
24
24
@@ -33,7 +33,7 @@ class HttpKernel implements BridgeInterface
33
33
* be able to be autoloaded.
34
34
*
35
35
* @param string $appBootstrap The name of the class used to bootstrap the application
36
- * @param string|null $appBootstrap The environment your application will use to bootstrap (if any)
36
+ * @param string|null $appenv The environment your application will use to bootstrap (if any)
37
37
* @see http://stackphp.com
38
38
*/
39
39
public function bootstrap ($ appBootstrap , $ appenv )
@@ -44,12 +44,7 @@ public function bootstrap($appBootstrap, $appenv)
44
44
require_once $ autoloader ;
45
45
}
46
46
47
- if (false === class_exists ($ appBootstrap )) {
48
- $ appBootstrap = '\\' . $ appBootstrap ;
49
- if (false === class_exists ($ appBootstrap )) {
50
- throw new \RuntimeException ('Could not find bootstrap class ' . $ appBootstrap );
51
- }
52
- }
47
+ $ appBootstrap = $ this ->normalizeAppBootstrap ($ appBootstrap );
53
48
54
49
$ bootstrap = new $ appBootstrap ($ appenv );
55
50
@@ -165,4 +160,22 @@ protected static function mapResponse(ReactResponse $reactResponse,
165
160
166
161
$ reactResponse ->end ($ content );
167
162
}
163
+
164
+ /**
165
+ * @param $appBootstrap
166
+ * @return string
167
+ * @throws \RuntimeException
168
+ */
169
+ protected function normalizeAppBootstrap ($ appBootstrap )
170
+ {
171
+ $ appBootstrap = str_replace ('\\\\' , '\\' , $ appBootstrap );
172
+ if (false === class_exists ($ appBootstrap )) {
173
+ $ appBootstrap = '\\' . $ appBootstrap ;
174
+ if (false === class_exists ($ appBootstrap )) {
175
+ throw new \RuntimeException ('Could not find bootstrap class ' . $ appBootstrap );
176
+ }
177
+ return $ appBootstrap ;
178
+ }
179
+ return $ appBootstrap ;
180
+ }
168
181
}
0 commit comments