mirror of
https://github.com/symfony/recipes-contrib.git
synced 2026-09-12 15:46:52 +03:00
Updated version
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use PHPFastCGI\FastCGIDaemon\Http\RequestInterface;
|
||||
use PHPFastCGI\FastCGIDaemon\KernelInterface as PHPFastCGIKernel;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\HttpKernel\TerminableInterface;
|
||||
|
||||
class FastCGIKernel implements PHPFastCGIKernel
|
||||
{
|
||||
private $kernel;
|
||||
|
||||
public function __construct(KernelInterface $kernel)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
}
|
||||
|
||||
public function handleRequest(RequestInterface $request)
|
||||
{
|
||||
$this->kernel->boot(); // Or ->reboot()
|
||||
|
||||
$symfonyRequest = $request->getHttpFoundationRequest();
|
||||
$symfonyResponse = $this->kernel->handle($symfonyRequest);
|
||||
|
||||
if ($this->kernel instanceof TerminableInterface) {
|
||||
$this->kernel->terminate($symfonyRequest, $symfonyResponse);
|
||||
}
|
||||
|
||||
return $symfonyResponse;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user