You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

3 years ago
  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\HttpKernel\Event;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\HttpKernel\HttpKernelInterface;
  14. /**
  15. * Allows to execute logic after a response was sent.
  16. *
  17. * Since it's only triggered on main requests, the `getRequestType()` method
  18. * will always return the value of `HttpKernelInterface::MAIN_REQUEST`.
  19. *
  20. * @author Jordi Boggiano <j.boggiano@seld.be>
  21. */
  22. final class TerminateEvent extends KernelEvent
  23. {
  24. private $response;
  25. public function __construct(HttpKernelInterface $kernel, Request $request, Response $response)
  26. {
  27. parent::__construct($kernel, $request, HttpKernelInterface::MAIN_REQUEST);
  28. $this->response = $response;
  29. }
  30. public function getResponse(): Response
  31. {
  32. return $this->response;
  33. }
  34. }