Skip to content

Commit fb5c83f

Browse files
committed
Fix #34
1 parent 2d40cb4 commit fb5c83f

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
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
1616
{
1717
/**
1818
* The PHP environment in which to bootstrap (such as 'dev' or 'production').
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 HooksInterface
1313
{
1414
/**
1515
* @var string|null The application environment

Bridges/HttpKernel.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class HttpKernel implements BridgeInterface
2323
protected $application;
2424

2525
/**
26-
* @var AbstractBootstrap
26+
* @var BootstrapInterface
2727
*/
2828
protected $bootstrap;
2929

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

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

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

0 commit comments

Comments
 (0)