TerminateEvent.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 master requests, the `getRequestType()` method
  18. * will always return the value of `HttpKernelInterface::MASTER_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::MASTER_REQUEST);
  28. $this->response = $response;
  29. }
  30. public function getResponse(): Response
  31. {
  32. return $this->response;
  33. }
  34. }