mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-02 21:19:58 +09:00
Update to laravel 7
This commit is contained in:
47
vendor/symfony/http-foundation/RequestStack.php
vendored
47
vendor/symfony/http-foundation/RequestStack.php
vendored
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
|
||||
/**
|
||||
* Request stack that controls the lifecycle of requests.
|
||||
*
|
||||
@@ -47,7 +50,7 @@ class RequestStack
|
||||
public function pop()
|
||||
{
|
||||
if (!$this->requests) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return array_pop($this->requests);
|
||||
@@ -62,23 +65,35 @@ class RequestStack
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the master Request.
|
||||
* Gets the main request.
|
||||
*
|
||||
* Be warned that making your code aware of the master request
|
||||
* Be warned that making your code aware of the main request
|
||||
* might make it un-compatible with other features of your framework
|
||||
* like ESI support.
|
||||
*
|
||||
* @return Request|null
|
||||
*/
|
||||
public function getMasterRequest()
|
||||
public function getMainRequest(): ?Request
|
||||
{
|
||||
if (!$this->requests) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->requests[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the master request.
|
||||
*
|
||||
* @return Request|null
|
||||
*
|
||||
* @deprecated since symfony/http-foundation 5.3, use getMainRequest() instead
|
||||
*/
|
||||
public function getMasterRequest()
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.3', '"%s()" is deprecated, use "getMainRequest()" instead.', __METHOD__);
|
||||
|
||||
return $this->getMainRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent request of the current.
|
||||
*
|
||||
@@ -86,7 +101,7 @@ class RequestStack
|
||||
* might make it un-compatible with other features of your framework
|
||||
* like ESI support.
|
||||
*
|
||||
* If current Request is the master request, it returns null.
|
||||
* If current Request is the main request, it returns null.
|
||||
*
|
||||
* @return Request|null
|
||||
*/
|
||||
@@ -94,10 +109,20 @@ class RequestStack
|
||||
{
|
||||
$pos = \count($this->requests) - 2;
|
||||
|
||||
if (!isset($this->requests[$pos])) {
|
||||
return;
|
||||
return $this->requests[$pos] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current session.
|
||||
*
|
||||
* @throws SessionNotFoundException
|
||||
*/
|
||||
public function getSession(): SessionInterface
|
||||
{
|
||||
if ((null !== $request = end($this->requests) ?: null) && $request->hasSession()) {
|
||||
return $request->getSession();
|
||||
}
|
||||
|
||||
return $this->requests[$pos];
|
||||
throw new SessionNotFoundException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user