You are here

public function RequestStack::getMainRequest in Drupal 9

Gets the main request.

Return value

\Symfony\Component\HttpFoundation\Request|null The main request.

1 call to RequestStack::getMainRequest()
RequestStack::getMasterRequest in core/lib/Drupal/Core/Http/RequestStack.php

File

core/lib/Drupal/Core/Http/RequestStack.php, line 21

Class

RequestStack
Forward-compatibility shim for Symfony's RequestStack.

Namespace

Drupal\Core\Http

Code

public function getMainRequest() : ?Request {
  if (method_exists(SymfonyRequestStack::class, 'getMainRequest')) {
    return parent::getMainRequest();
  }
  else {
    return parent::getMasterRequest();
  }
}