1212namespace CakeDC \PHPPM \Bridges ;
1313
1414use App \Application ;
15+ use Cake \Core \PluginApplicationInterface ;
16+ use Cake \Http \BaseApplication ;
1517use Cake \Http \MiddlewareQueue ;
1618use Cake \Http \Response ;
1719use Cake \Http \Runner ;
2325
2426class Cakephp implements BridgeInterface
2527{
26-
2728 /**
2829 * @var Server
2930 */
3031 protected $ server ;
3132
3233 /**
33- * @var string root path
34+ * @var BaseApplication $application
3435 */
35- protected $ root ;
36-
3736 protected $ application ;
3837
39- public function __construct ()
40- {
41- $ this ->root = dirname (__DIR__ , 5 );
42- }
43-
4438 /**
4539 * Bootstrap an application
4640 *
@@ -50,9 +44,10 @@ public function __construct()
5044 */
5145 public function bootstrap ($ appBootstrap , $ appenv , $ debug )
5246 {
53- require $ this ->root . '/config/requirements.php ' ;
54- require $ this ->root . '/vendor/autoload.php ' ;
55- $ this ->application = new Application ($ this ->root . '/config ' );
47+ $ root = dirname (__DIR__ , 5 );
48+ require $ root . '/config/requirements.php ' ;
49+ require $ root . '/vendor/autoload.php ' ;
50+ $ this ->application = new Application ($ root . '/config ' );
5651 $ this ->application ->bootstrap ();
5752 if ($ this ->application instanceof \Cake \Core \PluginApplicationInterface) {
5853 $ this ->application ->pluginBootstrap ();
@@ -67,13 +62,13 @@ public function bootstrap($appBootstrap, $appenv, $debug)
6762 *
6863 * @return ResponseInterface
6964 */
70- public function handle (ServerRequestInterface $ request )
65+ public function handle (ServerRequestInterface $ request ) : ResponseInterface
7166 {
7267 $ response = new Response ();
7368 $ request = ServerRequestFactory::fromGlobals ();
7469
7570 $ middleware = $ this ->application ->middleware (new MiddlewareQueue ());
76- if ($ this ->application instanceof \ Cake \ Core \ PluginApplicationInterface) {
71+ if ($ this ->application instanceof PluginApplicationInterface) {
7772 $ middleware = $ this ->application ->pluginMiddleware ($ middleware );
7873 }
7974
0 commit comments