Skip to content

Commit

Permalink
Merge pull request #1 from CakeDC/feature/upgrade
Browse files Browse the repository at this point in the history
Upgrade to latest phppm and cakephp
  • Loading branch information
steinkel committed Nov 29, 2019
2 parents 31cb4a4 + 899f96d commit a27b644
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
9 changes: 3 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@
"source": "https://github.com/CakeDC/cakephp-phppm"
},
"require": {
"php": ">=5.6",
"cakephp/cakephp": "^3.6",
"php-pm/php-pm": "^1.0",
"symfony/console": "^3.0",
"symfony/debug": "^3.0",
"symfony/process": "^2.6"
"php": ">=7.2",
"cakephp/cakephp": "^3.8",
"php-pm/php-pm": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
Expand Down
23 changes: 9 additions & 14 deletions src/Bridges/Cakephp.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
namespace CakeDC\PHPPM\Bridges;

use App\Application;
use Cake\Core\PluginApplicationInterface;
use Cake\Http\BaseApplication;
use Cake\Http\MiddlewareQueue;
use Cake\Http\Response;
use Cake\Http\Runner;
Expand All @@ -23,24 +25,16 @@

class Cakephp implements BridgeInterface
{

/**
* @var Server
*/
protected $server;

/**
* @var string root path
* @var BaseApplication $application
*/
protected $root;

protected $application;

public function __construct()
{
$this->root = dirname(__DIR__, 5);
}

/**
* Bootstrap an application
*
Expand All @@ -50,9 +44,10 @@ public function __construct()
*/
public function bootstrap($appBootstrap, $appenv, $debug)
{
require $this->root . '/config/requirements.php';
require $this->root . '/vendor/autoload.php';
$this->application = new Application($this->root . '/config');
$root = dirname(__DIR__, 5);
require $root . '/config/requirements.php';
require $root . '/vendor/autoload.php';
$this->application = new Application($root . '/config');
$this->application->bootstrap();
if ($this->application instanceof \Cake\Core\PluginApplicationInterface) {
$this->application->pluginBootstrap();
Expand All @@ -67,13 +62,13 @@ public function bootstrap($appBootstrap, $appenv, $debug)
*
* @return ResponseInterface
*/
public function handle(ServerRequestInterface $request)
public function handle(ServerRequestInterface $request) : ResponseInterface
{
$response = new Response();
$request = ServerRequestFactory::fromGlobals();

$middleware = $this->application->middleware(new MiddlewareQueue());
if ($this->application instanceof \Cake\Core\PluginApplicationInterface) {
if ($this->application instanceof PluginApplicationInterface) {
$middleware = $this->application->pluginMiddleware($middleware);
}

Expand Down

0 comments on commit a27b644

Please sign in to comment.