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

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. class HttpKernelRunner implements RunnerInterface
  19. {
  20. private $kernel;
  21. private $request;
  22. public function __construct(HttpKernelInterface $kernel, Request $request)
  23. {
  24. $this->kernel = $kernel;
  25. $this->request = $request;
  26. }
  27. public function run(): int
  28. {
  29. $response = $this->kernel->handle($this->request);
  30. $response->send();
  31. if ($this->kernel instanceof TerminableInterface) {
  32. $this->kernel->terminate($this->request, $response);
  33. }
  34. return 0;
  35. }
  36. }