Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
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 |
Profile.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\HttpKernel\Profiler;
013
014 use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
015
016 /**
017 * Profile.
018 *
019 * @author Fabien Potencier <fabien@symfony.com>
020 */
021 class Profile
022 {
023 private $token;
024
025 /**
026 * @var DataCollectorInterface[]
027 */
028 private $collectors = [];
029
030 private $ip;
031 private $method;
032 private $url;
033 private $time;
034 private $statusCode;
035
036 /**
037 * @var Profile
038 */
039 private $parent;
040
041 /**
042 * @var Profile[]
043 */
044 private $children = [];
045
046 /**
047 * @param string $token The token
048 */
049 public function __construct($token)
050 {
051 $this->token = $token;
052 }
053
054 /**
055 * Sets the token.
056 *
057 * @param string $token The token
058 */
059 public function setToken($token)
060 {
061 $this->token = $token;
062 }
063
064 /**
065 * Gets the token.
066 *
067 * @return string The token
068 */
069 public function getToken()
070 {
071 return $this->token;
072 }
073
074 /**
075 * Sets the parent token.
076 */
077 public function setParent(self $parent)
078 {
079 $this->parent = $parent;
080 }
081
082 /**
083 * Returns the parent profile.
084 *
085 * @return self
086 */
087 public function getParent()
088 {
089 return $this->parent;
090 }
091
092 /**
093 * Returns the parent token.
094 *
095 * @return string|null The parent token
096 */
097 public function getParentToken()
098 {
099 return $this->parent ? $this->parent->getToken() : null;
100 }
101
102 /**
103 * Returns the IP.
104 *
105 * @return string|null The IP
106 */
107 public function getIp()
108 {
109 return $this->ip;
110 }
111
112 /**
113 * Sets the IP.
114 *
115 * @param string $ip
116 */
117 public function setIp($ip)
118 {
119 $this->ip = $ip;
120 }
121
122 /**
123 * Returns the request method.
124 *
125 * @return string|null The request method
126 */
127 public function getMethod()
128 {
129 return $this->method;
130 }
131
132 public function setMethod($method)
133 {
134 $this->method = $method;
135 }
136
137 /**
138 * Returns the URL.
139 *
140 * @return string|null The URL
141 */
142 public function getUrl()
143 {
144 return $this->url;
145 }
146
147 /**
148 * @param string $url
149 */
150 public function setUrl($url)
151 {
152 $this->url = $url;
153 }
154
155 /**
156 * Returns the time.
157 *
158 * @return int The time
159 */
160 public function getTime()
161 {
162 if (null === $this->time) {
163 return 0;
164 }
165
166 return $this->time;
167 }
168
169 /**
170 * @param int $time The time
171 */
172 public function setTime($time)
173 {
174 $this->time = $time;
175 }
176
177 /**
178 * @param int $statusCode
179 */
180 public function setStatusCode($statusCode)
181 {
182 $this->statusCode = $statusCode;
183 }
184
185 /**
186 * @return int|null
187 */
188 public function getStatusCode()
189 {
190 return $this->statusCode;
191 }
192
193 /**
194 * Finds children profilers.
195 *
196 * @return self[]
197 */
198 public function getChildren()
199 {
200 return $this->children;
201 }
202
203 /**
204 * Sets children profiler.
205 *
206 * @param Profile[] $children
207 */
208 public function setChildren(array $children)
209 {
210 $this->children = [];
211 foreach ($children as $child) {
212 $this->addChild($child);
213 }
214 }
215
216 /**
217 * Adds the child token.
218 */
219 public function addChild(self $child)
220 {
221 $this->children[] = $child;
222 $child->setParent($this);
223 }
224
225 /**
226 * Gets a Collector by name.
227 *
228 * @param string $name A collector name
229 *
230 * @return DataCollectorInterface A DataCollectorInterface instance
231 *
232 * @throws \InvalidArgumentException if the collector does not exist
233 */
234 public function getCollector($name)
235 {
236 if (!isset($this->collectors[$name])) {
237 throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
238 }
239
240 return $this->collectors[$name];
241 }
242
243 /**
244 * Gets the Collectors associated with this profile.
245 *
246 * @return DataCollectorInterface[]
247 */
248 public function getCollectors()
249 {
250 return $this->collectors;
251 }
252
253 /**
254 * Sets the Collectors associated with this profile.
255 *
256 * @param DataCollectorInterface[] $collectors
257 */
258 public function setCollectors(array $collectors)
259 {
260 $this->collectors = [];
261 foreach ($collectors as $collector) {
262 $this->addCollector($collector);
263 }
264 }
265
266 /**
267 * Adds a Collector.
268 */
269 public function addCollector(DataCollectorInterface $collector)
270 {
271 $this->collectors[$collector->getName()] = $collector;
272 }
273
274 /**
275 * Returns true if a Collector for the given name exists.
276 *
277 * @param string $name A collector name
278 *
279 * @return bool
280 */
281 public function hasCollector($name)
282 {
283 return isset($this->collectors[$name]);
284 }
285
286 public function __sleep()
287 {
288 return ['token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time', 'statusCode'];
289 }
290 }
291