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 |
ProfilerExtension.php
01 <?php
02
03 /*
04 * This file is part of the Symfony package.
05 *
06 * (c) Fabien Potencier <fabien@symfony.com>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Bridge\Twig\Extension;
13
14 use Symfony\Component\Stopwatch\Stopwatch;
15
16 /**
17 * @author Fabien Potencier <fabien@symfony.com>
18 */
19 class ProfilerExtension extends \Twig_Extension_Profiler
20 {
21 private $stopwatch;
22 private $events;
23
24 public function __construct(\Twig_Profiler_Profile $profile, Stopwatch $stopwatch = null)
25 {
26 parent::__construct($profile);
27
28 $this->stopwatch = $stopwatch;
29 $this->events = new \SplObjectStorage();
30 }
31
32 public function enter(\Twig_Profiler_Profile $profile)
33 {
34 if ($this->stopwatch && $profile->isTemplate()) {
35 $this->events[$profile] = $this->stopwatch->start($profile->getName(), 'template');
36 }
37
38 parent::enter($profile);
39 }
40
41 public function leave(\Twig_Profiler_Profile $profile)
42 {
43 parent::leave($profile);
44
45 if ($this->stopwatch && $profile->isTemplate()) {
46 $this->events[$profile]->stop();
47 unset($this->events[$profile]);
48 }
49 }
50
51 /**
52 * {@inheritdoc}
53 */
54 public function getName()
55 {
56 return 'native_profiler';
57 }
58 }
59