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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Profile.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 5.46 KiB


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 = array();
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 = array();
045   
046      /**
047       * Constructor.
048       *
049       * @param string $token The token
050       */
051      public function __construct($token)
052      {
053          $this->token = $token;
054      }
055   
056      /**
057       * Sets the token.
058       *
059       * @param string $token The token
060       */
061      public function setToken($token)
062      {
063          $this->token = $token;
064      }
065   
066      /**
067       * Gets the token.
068       *
069       * @return string The token
070       */
071      public function getToken()
072      {
073          return $this->token;
074      }
075   
076      /**
077       * Sets the parent token.
078       *
079       * @param Profile $parent The parent Profile
080       */
081      public function setParent(Profile $parent)
082      {
083          $this->parent = $parent;
084      }
085   
086      /**
087       * Returns the parent profile.
088       *
089       * @return Profile The parent profile
090       */
091      public function getParent()
092      {
093          return $this->parent;
094      }
095   
096      /**
097       * Returns the parent token.
098       *
099       * @return null|string The parent token
100       */
101      public function getParentToken()
102      {
103          return $this->parent ? $this->parent->getToken() : null;
104      }
105   
106      /**
107       * Returns the IP.
108       *
109       * @return string The IP
110       */
111      public function getIp()
112      {
113          return $this->ip;
114      }
115   
116      /**
117       * Sets the IP.
118       *
119       * @param string $ip
120       */
121      public function setIp($ip)
122      {
123          $this->ip = $ip;
124      }
125   
126      /**
127       * Returns the request method.
128       *
129       * @return string The request method
130       */
131      public function getMethod()
132      {
133          return $this->method;
134      }
135   
136      public function setMethod($method)
137      {
138          $this->method = $method;
139      }
140   
141      /**
142       * Returns the URL.
143       *
144       * @return string The URL
145       */
146      public function getUrl()
147      {
148          return $this->url;
149      }
150   
151      public function setUrl($url)
152      {
153          $this->url = $url;
154      }
155   
156      /**
157       * Returns the time.
158       *
159       * @return string The time
160       */
161      public function getTime()
162      {
163          if (null === $this->time) {
164              return 0;
165          }
166   
167          return $this->time;
168      }
169   
170      public function setTime($time)
171      {
172          $this->time = $time;
173      }
174   
175      /**
176       * @param int $statusCode
177       */
178      public function setStatusCode($statusCode)
179      {
180          $this->statusCode = $statusCode;
181      }
182   
183      /**
184       * @return int
185       */
186      public function getStatusCode()
187      {
188          return $this->statusCode;
189      }
190   
191      /**
192       * Finds children profilers.
193       *
194       * @return Profile[] An array of Profile
195       */
196      public function getChildren()
197      {
198          return $this->children;
199      }
200   
201      /**
202       * Sets children profiler.
203       *
204       * @param Profile[] $children An array of Profile
205       */
206      public function setChildren(array $children)
207      {
208          $this->children = array();
209          foreach ($children as $child) {
210              $this->addChild($child);
211          }
212      }
213   
214      /**
215       * Adds the child token.
216       *
217       * @param Profile $child The child Profile
218       */
219      public function addChild(Profile $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 = array();
261          foreach ($collectors as $collector) {
262              $this->addCollector($collector);
263          }
264      }
265   
266      /**
267       * Adds a Collector.
268       *
269       * @param DataCollectorInterface $collector A DataCollectorInterface instance
270       */
271      public function addCollector(DataCollectorInterface $collector)
272      {
273          $this->collectors[$collector->getName()] = $collector;
274      }
275   
276      /**
277       * Returns true if a Collector for the given name exists.
278       *
279       * @param string $name A collector name
280       *
281       * @return bool
282       */
283      public function hasCollector($name)
284      {
285          return isset($this->collectors[$name]);
286      }
287   
288      public function __sleep()
289      {
290          return array('token', 'parent', 'children', 'collectors', 'ip', 'method', 'url', 'time');
291      }
292  }
293