class RequestStack in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/RequestStack.php \Symfony\Component\HttpFoundation\RequestStack
Request stack that controls the lifecycle of requests.
@author Benjamin Eberlei <kontakt@beberlei.de>
Hierarchy
- class \Symfony\Component\HttpFoundation\RequestStack
Expanded class hierarchy of RequestStack
96 files declare their use of RequestStack
- AjaxBasePageNegotiator.php in core/
lib/ Drupal/ Core/ Theme/ AjaxBasePageNegotiator.php - Contains \Drupal\Core\Theme\AjaxBasePageNegotiator.
- AjaxResponseAttachmentsProcessor.php in core/
lib/ Drupal/ Core/ Ajax/ AjaxResponseAttachmentsProcessor.php - Contains \Drupal\Core\Ajax\AjaxResponseAttachmentsProcessor.
- BatchNegotiator.php in core/
modules/ system/ src/ Theme/ BatchNegotiator.php - Contains \Drupal\system\Theme\BatchNegotiator.
- BookNavigationBlock.php in core/
modules/ book/ src/ Plugin/ Block/ BookNavigationBlock.php - Contains \Drupal\book\Plugin\Block\BookNavigationBlock.
- BookNavigationCacheContext.php in core/
modules/ book/ src/ Cache/ BookNavigationCacheContext.php - Contains \Drupal\book\Cache\BookNavigationCacheContext.
1 string reference to 'RequestStack'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses RequestStack
File
- vendor/
symfony/ http-foundation/ RequestStack.php, line 19
Namespace
Symfony\Component\HttpFoundationView source
class RequestStack {
/**
* @var Request[]
*/
private $requests = array();
/**
* Pushes a Request on the stack.
*
* This method should generally not be called directly as the stack
* management should be taken care of by the application itself.
*/
public function push(Request $request) {
$this->requests[] = $request;
}
/**
* Pops the current request from the stack.
*
* This operation lets the current request go out of scope.
*
* This method should generally not be called directly as the stack
* management should be taken care of by the application itself.
*
* @return Request|null
*/
public function pop() {
if (!$this->requests) {
return;
}
return array_pop($this->requests);
}
/**
* @return Request|null
*/
public function getCurrentRequest() {
return end($this->requests) ?: null;
}
/**
* Gets the master Request.
*
* Be warned that making your code aware of the master request
* might make it un-compatible with other features of your framework
* like ESI support.
*
* @return Request|null
*/
public function getMasterRequest() {
if (!$this->requests) {
return;
}
return $this->requests[0];
}
/**
* Returns the parent request of the current.
*
* Be warned that making your code aware of the parent request
* might make it un-compatible with other features of your framework
* like ESI support.
*
* If current Request is the master request, it returns null.
*
* @return Request|null
*/
public function getParentRequest() {
$pos = count($this->requests) - 2;
if (!isset($this->requests[$pos])) {
return;
}
return $this->requests[$pos];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RequestStack:: |
private | property | ||
RequestStack:: |
public | function | ||
RequestStack:: |
public | function | Gets the master Request. | |
RequestStack:: |
public | function | Returns the parent request of the current. | |
RequestStack:: |
public | function | Pops the current request from the stack. | |
RequestStack:: |
public | function | Pushes a Request on the stack. |