Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
RequestStack.php
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\HttpFoundation;
013
014 /**
015 * Request stack that controls the lifecycle of requests.
016 *
017 * @author Benjamin Eberlei <kontakt@beberlei.de>
018 */
019 class RequestStack
020 {
021 /**
022 * @var Request[]
023 */
024 private $requests = array();
025
026 /**
027 * Pushes a Request on the stack.
028 *
029 * This method should generally not be called directly as the stack
030 * management should be taken care of by the application itself.
031 */
032 public function push(Request $request)
033 {
034 $this->requests[] = $request;
035 }
036
037 /**
038 * Pops the current request from the stack.
039 *
040 * This operation lets the current request go out of scope.
041 *
042 * This method should generally not be called directly as the stack
043 * management should be taken care of by the application itself.
044 *
045 * @return Request|null
046 */
047 public function pop()
048 {
049 if (!$this->requests) {
050 return;
051 }
052
053 return array_pop($this->requests);
054 }
055
056 /**
057 * @return Request|null
058 */
059 public function getCurrentRequest()
060 {
061 return end($this->requests) ?: null;
062 }
063
064 /**
065 * Gets the master Request.
066 *
067 * Be warned that making your code aware of the master request
068 * might make it un-compatible with other features of your framework
069 * like ESI support.
070 *
071 * @return Request|null
072 */
073 public function getMasterRequest()
074 {
075 if (!$this->requests) {
076 return;
077 }
078
079 return $this->requests[0];
080 }
081
082 /**
083 * Returns the parent request of the current.
084 *
085 * Be warned that making your code aware of the parent request
086 * might make it un-compatible with other features of your framework
087 * like ESI support.
088 *
089 * If current Request is the master request, it returns null.
090 *
091 * @return Request|null
092 */
093 public function getParentRequest()
094 {
095 $pos = count($this->requests) - 2;
096
097 if (!isset($this->requests[$pos])) {
098 return;
099 }
100
101 return $this->requests[$pos];
102 }
103 }
104