Open Journal Systems  3.3.0
lib/vendor/symfony/http-foundation/RequestStack.php
1 <?php
2 
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
13 
20 {
24  private $requests = array();
25 
32  public function push(Request $request)
33  {
34  $this->requests[] = $request;
35  }
36 
47  public function pop()
48  {
49  if (!$this->requests) {
50  return;
51  }
52 
53  return array_pop($this->requests);
54  }
55 
59  public function getCurrentRequest()
60  {
61  return end($this->requests) ?: null;
62  }
63 
73  public function getMasterRequest()
74  {
75  if (!$this->requests) {
76  return;
77  }
78 
79  return $this->requests[0];
80  }
81 
93  public function getParentRequest()
94  {
95  $pos = count($this->requests) - 2;
96 
97  if (!isset($this->requests[$pos])) {
98  return;
99  }
100 
101  return $this->requests[$pos];
102  }
103 }
Symfony\Component\HttpFoundation\RequestStack\push
push(Request $request)
Definition: lib/vendor/symfony/http-foundation/RequestStack.php:35
Symfony\Component\HttpFoundation\RequestStack\getParentRequest
getParentRequest()
Definition: lib/vendor/symfony/http-foundation/RequestStack.php:96
Symfony\Component\HttpFoundation\Request
Definition: lib/vendor/symfony/http-foundation/Request.php:31
Symfony\Component\HttpFoundation\RequestStack
Definition: lib/vendor/symfony/http-foundation/RequestStack.php:19
Symfony\Component\HttpFoundation\RequestStack\getCurrentRequest
getCurrentRequest()
Definition: lib/vendor/symfony/http-foundation/RequestStack.php:62
Symfony\Component\HttpFoundation
Definition: lib/vendor/symfony/http-foundation/AcceptHeader.php:12
Symfony\Component\HttpFoundation\RequestStack\pop
pop()
Definition: lib/vendor/symfony/http-foundation/RequestStack.php:50
Symfony\Component\HttpFoundation\RequestStack\getMasterRequest
getMasterRequest()
Definition: lib/vendor/symfony/http-foundation/RequestStack.php:76