Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
98.95% |
94 / 95 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | use Framework\Debug\Debugger; |
| 4 | |
| 5 | /** |
| 6 | * @var array<string,Framework\Debug\Collection> $collections |
| 7 | * @var array<string,mixed> $activities |
| 8 | * @var array<string,mixed> $options |
| 9 | */ |
| 10 | ?> |
| 11 | <!-- Aplus Framework Debugbar start --> |
| 12 | <style> |
| 13 | <?= file_get_contents(__DIR__ . '/../assets/prism-aplus.css') ?> |
| 14 | </style> |
| 15 | <style> |
| 16 | <?php |
| 17 | $contents = file_get_contents(__DIR__ . '/styles.css'); |
| 18 | if (isset($options['color'])) { |
| 19 | $contents = strtr($contents, ['magenta' => $options['color']]); // @phpstan-ignore-line |
| 20 | } |
| 21 | echo $contents; |
| 22 | ?> |
| 23 | </style> |
| 24 | <div id="debugbar" class="aplus-debug"> |
| 25 | <div class="panels"> |
| 26 | <div class="panel info-collection"> |
| 27 | <div class="resize"></div> |
| 28 | <header> |
| 29 | <div class="title">Info</div> |
| 30 | </header> |
| 31 | <div class="contents"> |
| 32 | <div class="collector-default"> |
| 33 | <p>Running<?= |
| 34 | class_exists('Aplus') |
| 35 | ? ' Aplus ' . Debugger::roundVersion(Aplus::VERSION) |
| 36 | : '' ?> on <?= \PHP_OS_FAMILY ?> with PHP |
| 37 | <?= Debugger::roundVersion(\PHP_VERSION) ?> |
| 38 | </p> |
| 39 | <p>★ |
| 40 | <a href="https://aplus-framework.com" target="_blank">aplus-framework.com</a> |
| 41 | </p> |
| 42 | <?php |
| 43 | $count = isset($activities['collected']) ? count($activities['collected']) : 0; |
| 44 | if ($count): |
| 45 | ?> |
| 46 | <p><?= $count ?> activit<?= $count === 1 |
| 47 | ? 'y was' |
| 48 | : 'ies were' ?> collected in <?= round($activities['total'], 6) ?> seconds: |
| 49 | </p> |
| 50 | <table> |
| 51 | <thead> |
| 52 | <tr> |
| 53 | <th>#</th> |
| 54 | <th>Collection</th> |
| 55 | <th>Collector</th> |
| 56 | <th>Description</th> |
| 57 | <th title="Seconds">Runtime</th> |
| 58 | <th title="Runtime percentages"> |
| 59 | <span>10%</span><span>20%</span><span>30%</span><span>40%</span> |
| 60 | <span>50%</span><span>60%</span><span>70%</span><span>80%</span> |
| 61 | <span>90%</span><span>100%</span> |
| 62 | </th> |
| 63 | </tr> |
| 64 | </thead> |
| 65 | <tbody> |
| 66 | <?php foreach ($activities['collected'] as $index => $collected): ?> |
| 67 | <tr> |
| 68 | <td><?= $index + 1 ?></td> |
| 69 | <td><?= htmlentities($collected['collection']) ?></td> |
| 70 | <td title="<?= htmlentities($collected['class']) ?>"><?= htmlentities($collected['collector']) ?></td> |
| 71 | <td><?= htmlentities($collected['description']) ?></td> |
| 72 | <td><?= round($collected['total'], 6) ?></td> |
| 73 | <td> |
| 74 | <span style="width: <?= $collected['width'] ?>%; margin-left: <?= |
| 75 | $collected['left'] |
| 76 | ?>%" title="<?= $collected['width'] ?>% · From <?= |
| 77 | $collected['left'] ?>% to <?= |
| 78 | $collected['left'] + $collected['width'] ?>% · From <?= |
| 79 | round($collected['start'], 6) ?> to <?= round($collected['end'], 6) ?> second"></span> |
| 80 | </td> |
| 81 | </tr> |
| 82 | <?php endforeach ?> |
| 83 | </tbody> |
| 84 | </table> |
| 85 | <?php |
| 86 | endif |
| 87 | ?> |
| 88 | </div> |
| 89 | </div> |
| 90 | </div> |
| 91 | <?php foreach ($collections as $collection): ?> |
| 92 | <?php if ($collection->hasCollectors()): ?> |
| 93 | <div class="panel <?= $collection->getSafeName() ?>-collection"> |
| 94 | <div class="resize"></div> |
| 95 | <header> |
| 96 | <div class="title"><?= $collection->getName() ?></div> |
| 97 | <div class="actions"><?= implode(' ', $collection->getActions()) ?></div> |
| 98 | <div class="collectors"> |
| 99 | <?php |
| 100 | $collectors = $collection->getCollectors(); |
| 101 | ?> |
| 102 | <select title="<?= $collection->getSafeName() ?> collectors"<?= |
| 103 | count($collectors) === 1 ? ' disabled' : '' ?>> |
| 104 | <?php foreach ($collectors as $collector): ?> |
| 105 | <option value="<?= $collector->getSafeName() ?>"><?= $collector->getName() ?></option> |
| 106 | <?php endforeach ?> |
| 107 | </select> |
| 108 | </div> |
| 109 | </header> |
| 110 | <div class="contents"> |
| 111 | <?php foreach ($collection->getCollectors() as $collector): ?> |
| 112 | <div class="collector-<?= $collector->getSafeName() ?>"><?= $collector->getContents() ?></div> |
| 113 | <?php endforeach ?> |
| 114 | </div> |
| 115 | </div> |
| 116 | <?php endif ?> |
| 117 | <?php endforeach ?> |
| 118 | </div> |
| 119 | <div class="toolbar"> |
| 120 | <div class="icon"> |
| 121 | <img src="data:image/png;base64,<?= base64_encode((string) file_get_contents(__DIR__ . '/icon.png')) ?>" alt="A+" width="32"> |
| 122 | </div> |
| 123 | <div class="collections"> |
| 124 | <?php foreach ($collections as $collection): ?> |
| 125 | <?php if ($collection->hasCollectors()): ?> |
| 126 | <button class="collection" id="<?= $collection->getSafeName() ?>-collection"><?= $collection->getName() ?></button> |
| 127 | <?php endif ?> |
| 128 | <?php endforeach ?> |
| 129 | <div class="info"> |
| 130 | <button class="collection" id="info-collection">Info</button> |
| 131 | </div> |
| 132 | </div> |
| 133 | </div> |
| 134 | </div> |
| 135 | <script> |
| 136 | window.Prism = {}; |
| 137 | Prism.manual = true; |
| 138 | <?= file_get_contents(__DIR__ . '/../assets/prism.js') ?> |
| 139 | Prism.highlightAllUnder(document.querySelector('#debugbar .panels')); |
| 140 | </script> |
| 141 | <script> |
| 142 | <?= file_get_contents(__DIR__ . '/scripts.js') ?> |
| 143 | Debugbar.init(); |
| 144 | </script> |
| 145 | <!-- Aplus Framework Debugbar end --> |