function RequestStack::getMainRequest

Same name in other branches
  1. 10 core/lib/Drupal/Core/Http/RequestStack.php \Drupal\Core\Http\RequestStack::getMainRequest()

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();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.