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 |
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 use Twig\Extension\ProfilerExtension as BaseProfilerExtension;
16 use Twig\Profiler\Profile;
17
18 /**
19 * @author Fabien Potencier <fabien@symfony.com>
20 */
21 class ProfilerExtension extends BaseProfilerExtension
22 {
23 private $stopwatch;
24 private $events;
25
26 public function __construct(Profile $profile, Stopwatch $stopwatch = null)
27 {
28 parent::__construct($profile);
29
30 $this->stopwatch = $stopwatch;
31 $this->events = new \SplObjectStorage();
32 }
33
34 public function enter(Profile $profile)
35 {
36 if ($this->stopwatch && $profile->isTemplate()) {
37 $this->events[$profile] = $this->stopwatch->start($profile->getName(), 'template');
38 }
39
40 parent::enter($profile);
41 }
42
43 public function leave(Profile $profile)
44 {
45 parent::leave($profile);
46
47 if ($this->stopwatch && $profile->isTemplate()) {
48 $this->events[$profile]->stop();
49 unset($this->events[$profile]);
50 }
51 }
52
53 /**
54 * {@inheritdoc}
55 */
56 public function getName()
57 {
58 return 'native_profiler';
59 }
60 }
61