Skip to content

Commit 09fb0ae

Browse files
committed
Merge pull request #35 from andig/deps
Fix #34
2 parents bb4c23d + 3648796 commit 09fb0ae

File tree

6 files changed

+22
-21
lines changed

6 files changed

+22
-21
lines changed

Bootstraps/AbstractBootstrap.php

-15
This file was deleted.

Bootstraps/Drupal.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @see \PHPPM\Bootstraps\Symfony
1313
* @see \PHPPM\Bridges\HttpKernel
1414
*/
15-
class Drupal extends AbstractBootstrap
15+
class Drupal implements BootstrapInterface
1616
{
1717
/**
1818
* The PHP environment in which to bootstrap (such as 'dev' or 'production').

Bootstraps/Laravel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* A default bootstrap for the Laravel framework
77
*/
8-
class Laravel implements BootstrapInterface, HooksInterface
8+
class Laravel implements BootstrapInterface, HooksInterface, RequestClassProviderInterface
99
{
1010
/**
1111
* @var string|null The application environment
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace PHPPM\Bootstraps;
4+
5+
/**
6+
* Implement this interface if HttpKernel bridge needs to return a specialized request class
7+
*/
8+
interface RequestClassProviderInterface
9+
{
10+
public function requestClass();
11+
}

Bootstraps/Symfony.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**
1010
* A default bootstrap for the Symfony framework
1111
*/
12-
class Symfony extends AbstractBootstrap implements HooksInterface
12+
class Symfony implements BootstrapInterface, HooksInterface
1313
{
1414
/**
1515
* @var string|null The application environment

Bridges/HttpKernel.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace PHPPM\Bridges;
44

5-
use PHPPM\Bootstraps\AbstractBootstrap;
65
use PHPPM\Bootstraps\BootstrapInterface;
76
use PHPPM\Bootstraps\HooksInterface;
7+
use PHPPM\Bootstraps\RequestClassProviderInterface;
88
use PHPPM\React\HttpResponse;
99
use PHPPM\Utils;
1010
use React\Http\Request as ReactRequest;
@@ -24,7 +24,7 @@ class HttpKernel implements BridgeInterface
2424
protected $application;
2525

2626
/**
27-
* @var AbstractBootstrap
27+
* @var BootstrapInterface
2828
*/
2929
protected $bootstrap;
3030

@@ -147,7 +147,12 @@ protected function mapRequest(ReactRequest $reactRequest)
147147
$files = $reactRequest->getFiles();
148148
$post = $reactRequest->getPost();
149149

150-
$class = $this->bootstrap->requestClass();
150+
if ($this->bootstrap instanceof RequestClassProviderInterface) {
151+
$class = $this->bootstrap->requestClass();
152+
}
153+
else {
154+
$class = '\Symfony\Component\HttpFoundation\Request';
155+
}
151156

152157
$syRequest = new $class($query, $post, $attributes = [], $cookies, $files, $_SERVER, $reactRequest->getBody());
153158

0 commit comments

Comments
 (0)