KernelPreHandle.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace Drupal\Core\StackMiddleware;
  3. use Drupal\Core\DrupalKernelInterface;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpKernel\HttpKernelInterface;
  6. /**
  7. * Prepares the environment after page caching ran.
  8. */
  9. class KernelPreHandle implements HttpKernelInterface {
  10. /**
  11. * The wrapped HTTP kernel.
  12. *
  13. * @var \Symfony\Component\HttpKernel\HttpKernelInterface
  14. */
  15. protected $httpKernel;
  16. /**
  17. * The main Drupal kernel.
  18. *
  19. * @var \Drupal\Core\DrupalKernelInterface
  20. */
  21. protected $drupalKernel;
  22. /**
  23. * Constructs a new KernelPreHandle instance.
  24. *
  25. * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
  26. * The wrapped HTTP kernel.
  27. * @param \Drupal\Core\DrupalKernelInterface $drupal_kernel
  28. * The main Drupal kernel.
  29. */
  30. public function __construct(HttpKernelInterface $http_kernel, DrupalKernelInterface $drupal_kernel) {
  31. $this->httpKernel = $http_kernel;
  32. $this->drupalKernel = $drupal_kernel;
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
  38. $this->drupalKernel->preHandle($request);
  39. return $this->httpKernel->handle($request, $type, $catch);
  40. }
  41. }