Skip to content

Commit a27b644

Browse files
authored
Merge pull request #1 from CakeDC/feature/upgrade
Upgrade to latest phppm and cakephp
2 parents 31cb4a4 + 899f96d commit a27b644

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

composer.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,9 @@
2525
"source": "https://github.com/CakeDC/cakephp-phppm"
2626
},
2727
"require": {
28-
"php": ">=5.6",
29-
"cakephp/cakephp": "^3.6",
30-
"php-pm/php-pm": "^1.0",
31-
"symfony/console": "^3.0",
32-
"symfony/debug": "^3.0",
33-
"symfony/process": "^2.6"
28+
"php": ">=7.2",
29+
"cakephp/cakephp": "^3.8",
30+
"php-pm/php-pm": "^2.0"
3431
},
3532
"require-dev": {
3633
"phpunit/phpunit": "^6.0",

src/Bridges/Cakephp.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace CakeDC\PHPPM\Bridges;
1313

1414
use App\Application;
15+
use Cake\Core\PluginApplicationInterface;
16+
use Cake\Http\BaseApplication;
1517
use Cake\Http\MiddlewareQueue;
1618
use Cake\Http\Response;
1719
use Cake\Http\Runner;
@@ -23,24 +25,16 @@
2325

2426
class 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

Comments
 (0)