public static function Drupal::hasRequest
public static Drupal::hasRequest()
Indicates if there is a currently active request object.
Return value
bool TRUE if there is a currently active request object, FALSE otherwise.
File
- core/lib/Drupal.php, line 190
- Contains \Drupal.
Class
- Drupal
- Static Service Container wrapper.
Code
public static function hasRequest() { // Check hasContainer() first in order to always return a Boolean. return static::hasContainer() && static::getContainer()->has('request_stack') && static::getContainer()->get('request_stack')->getCurrentRequest() !== NULL; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal.php/function/Drupal::hasRequest/8.1.x