Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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