vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php line 37

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Runtime\Runner\Symfony;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpKernel\HttpKernelInterface;
  13. use Symfony\Component\HttpKernel\TerminableInterface;
  14. use Symfony\Component\Runtime\RunnerInterface;
  15. /**
  16.  * @author Nicolas Grekas <p@tchwork.com>
  17.  *
  18.  * @experimental in 5.3
  19.  */
  20. class HttpKernelRunner implements RunnerInterface
  21. {
  22.     private $kernel;
  23.     private $request;
  24.     public function __construct(HttpKernelInterface $kernelRequest $request)
  25.     {
  26.         $this->kernel $kernel;
  27.         $this->request $request;
  28.     }
  29.     public function run(): int
  30.     {
  31.         $response $this->kernel->handle($this->request);
  32.         $response->send();
  33.         if ($this->kernel instanceof TerminableInterface) {
  34.             $this->kernel->terminate($this->request$response);
  35.         }
  36.         return 0;
  37.     }
  38. }