PluginProbe
WPIDE – File Manager & Code Editor / 3.5.9
WPIDE – File Manager & Code Editor v3.5.9
3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 All 55 releases
← All changes | vendor/symfony/http-foundation/RequestStack.php +35 -6 3.33.5.9 View file →
@@ -10,8 +10,11 @@
10 10 */
11 11
12 12 namespace Symfony\Component\HttpFoundation;
13 13
14 +use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;
15 +use Symfony\Component\HttpFoundation\Session\SessionInterface;
16 +
14 17 /**
15 18 * Request stack that controls the lifecycle of requests.
16 19 *
17 20 * @author Benjamin Eberlei <kontakt@beberlei.de>
@@ -61,17 +64,15 @@
61 64 return end($this->requests) ?: null;
62 65 }
63 66
64 67 /**
65 - * Gets the master Request.
68 + * Gets the main request.
66 69 *
67 - * Be warned that making your code aware of the master request
70 + * Be warned that making your code aware of the main request
68 71 * might make it un-compatible with other features of your framework
69 72 * like ESI support.
70 - *
71 - * @return Request|null
72 73 */
73 - public function getMasterRequest()
74 + public function getMainRequest(): ?Request
74 75 {
75 76 if (!$this->requests) {
76 77 return null;
77 78 }
@@ -79,8 +80,22 @@
79 80 return $this->requests[0];
80 81 }
81 82
82 83 /**
84 + * Gets the master request.
85 + *
86 + * @return Request|null
87 + *
88 + * @deprecated since symfony/http-foundation 5.3, use getMainRequest() instead
89 + */
90 + public function getMasterRequest()
91 + {
92 + trigger_deprecation('symfony/http-foundation', '5.3', '"%s()" is deprecated, use "getMainRequest()" instead.', __METHOD__);
93 +
94 + return $this->getMainRequest();
95 + }
96 +
97 + /**
83 98 * Returns the parent request of the current.
84 99 *
85 100 * Be warned that making your code aware of the parent request
86 101 * might make it un-compatible with other features of your framework
@@ -85,9 +100,9 @@
85 100 * Be warned that making your code aware of the parent request
86 101 * might make it un-compatible with other features of your framework
87 102 * like ESI support.
88 103 *
89 - * If current Request is the master request, it returns null.
104 + * If current Request is the main request, it returns null.
90 105 *
91 106 * @return Request|null
92 107 */
93 108 public function getParentRequest()
@@ -94,6 +109,20 @@
94 109 {
95 110 $pos = \count($this->requests) - 2;
96 111
97 112 return $this->requests[$pos] ?? null;
113 + }
114 +
115 + /**
116 + * Gets the current session.
117 + *
118 + * @throws SessionNotFoundException
119 + */
120 + public function getSession(): SessionInterface
121 + {
122 + if ((null !== $request = end($this->requests) ?: null) && $request->hasSession()) {
123 + return $request->getSession();
124 + }
125 +
126 + throw new SessionNotFoundException();
98 127 }
99 128 }