mirror of
https://github.com/symfony/recipes-contrib.git
synced 2026-09-12 07:36:34 +03:00
34 lines
839 B
PHP
34 lines
839 B
PHP
<?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();
|
|
|
|
$symfonyRequest = $request->getHttpFoundationRequest();
|
|
$symfonyResponse = $this->kernel->handle($symfonyRequest);
|
|
|
|
if ($this->kernel instanceof TerminableInterface) {
|
|
$this->kernel->terminate($symfonyRequest, $symfonyResponse);
|
|
}
|
|
|
|
return $symfonyResponse;
|
|
}
|
|
}
|
|
|