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 |
BaseDumper.php
01 <?php
02
03 /*
04 * This file is part of Twig.
05 *
06 * (c) Fabien Potencier
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 Twig\Profiler\Dumper;
13
14 use Twig\Profiler\Profile;
15
16 /**
17 * @author Fabien Potencier <fabien@symfony.com>
18 */
19 abstract class BaseDumper
20 {
21 private $root;
22
23 public function dump(Profile $profile)
24 {
25 return $this->dumpProfile($profile);
26 }
27
28 abstract protected function formatTemplate(Profile $profile, $prefix);
29
30 abstract protected function formatNonTemplate(Profile $profile, $prefix);
31
32 abstract protected function formatTime(Profile $profile, $percent);
33
34 private function dumpProfile(Profile $profile, $prefix = '', $sibling = false): string
35 {
36 if ($profile->isRoot()) {
37 $this->root = $profile->getDuration();
38 $start = $profile->getName();
39 } else {
40 if ($profile->isTemplate()) {
41 $start = $this->formatTemplate($profile, $prefix);
42 } else {
43 $start = $this->formatNonTemplate($profile, $prefix);
44 }
45 $prefix .= $sibling ? '│ ' : ' ';
46 }
47
48 $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0;
49
50 if ($profile->getDuration() * 1000 < 1) {
51 $str = $start."\n";
52 } else {
53 $str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent));
54 }
55
56 $nCount = \count($profile->getProfiles());
57 foreach ($profile as $i => $p) {
58 $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount);
59 }
60
61 return $str;
62 }
63 }
64
65 class_alias('Twig\Profiler\Dumper\BaseDumper', 'Twig_Profiler_Dumper_Base');
66