• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aplus-framework / debug / 16306030688

15 Jul 2025 10:51PM UTC coverage: 97.866% (-0.02%) from 97.89%
16306030688

push

github

natanfelles
Update user guide

688 of 703 relevant lines covered (97.87%)

4.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.95
/src/Views/debugbar/debugbar.php
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
$infoIcon = file_get_contents(__DIR__ . '/icons/info.svg');
7✔
11
if (!isset($options['info_contents'])) {
7✔
12
    $options['info_contents'] = '<p>★ <a href="https://aplus-framework.com" target="_blank">aplus-framework.com</a></p>';
7✔
13
}
14
$iconPath = __DIR__ . '/icon.png';
7✔
15
if (isset($options['icon_path'])) {
7✔
16
    $iconPath = $options['icon_path'];
2✔
17
}
18
if (!is_file($iconPath)) {
7✔
19
    throw new LogicException('Icon not found: ' . $iconPath);
1✔
20
}
21
?>
22
<!-- Aplus Framework Debugbar start -->
6✔
23
<style>
6✔
24
    <?= file_get_contents(__DIR__ . '/../assets/prism-aplus.css') ?>
6✔
25
</style>
6✔
26
<style>
6✔
27
    <?php
6✔
28
    $contents = file_get_contents(__DIR__ . '/styles.css');
6✔
29
if (isset($options['color'])) {
6✔
30
    $contents = strtr($contents, ['magenta' => $options['color']]); // @phpstan-ignore-line
1✔
31
}
32
echo $contents;
6✔
33
?>
34
</style>
6✔
35
<div id="debugbar" class="aplus-debug" dir="ltr">
6✔
36
    <div class="panels">
6✔
37
        <div class="panel info-collection">
6✔
38
            <div class="resize" title="Change panel height"></div>
6✔
39
            <header>
6✔
40
                <div class="title"><?= $infoIcon ?> Info</div>
6✔
41
            </header>
42
            <div class="contents">
43
                <div class="collector-default">
44
                    <p>Running<?=
6✔
45
                        class_exists('Aplus')
6✔
46
                            ? ' <a href="https://aplus-framework.com" target="_blank" class="aplus-link">Aplus</a> ' . Debugger::roundVersion(Aplus::VERSION)
×
47
                            : '' ?> on <?= \PHP_OS_FAMILY ?> with PHP
6✔
48
                        <?= Debugger::roundVersion(\PHP_VERSION) ?>.
6✔
49
                    </p>
50
                    <?= $options['info_contents'] ?>
6✔
51
                    <?php
6✔
52
                $count = isset($activities['collected']) ? count($activities['collected']) : 0;
6✔
53
if ($count):
6✔
54
    ?>
55
                        <p><?= $count ?> activit<?= $count === 1
1✔
56
            ? 'y was'
1✔
57
            : 'ies were' ?> collected in <?= Debugger::roundSecondsToMilliseconds($activities['total']) ?> milliseconds:
1✔
58
                        </p>
59
                        <table>
60
                            <thead>
61
                            <tr>
62
                                <th>#</th>
63
                                <th>Collection</th>
64
                                <th>Collector</th>
65
                                <th>Description</th>
66
                                <th title="Milliseconds">Runtime</th>
67
                                <th title="Runtime percentages">
68
                                    <span>10%</span><span>20%</span><span>30%</span><span>40%</span>
69
                                    <span>50%</span><span>60%</span><span>70%</span><span>80%</span>
70
                                    <span>90%</span><span>100%</span>
71
                                </th>
72
                            </tr>
73
                            </thead>
74
                            <tbody>
75
                            <?php foreach ($activities['collected'] as $index => $collected): ?>
1✔
76
                                <tr>
1✔
77
                                    <td><?= $index + 1 ?></td>
1✔
78
                                    <td><?= htmlentities($collected['collection']) ?></td>
1✔
79
                                    <td title="<?= htmlentities($collected['class']) ?>"><?= htmlentities($collected['collector']) ?></td>
1✔
80
                                    <td><?= htmlentities($collected['description']) ?></td>
1✔
81
                                    <td><?= Debugger::roundSecondsToMilliseconds($collected['total']) ?></td>
1✔
82
                                    <td>
83
                                    <span style="width: <?= $collected['width'] ?>%; margin-left: <?=
1✔
84
                $collected['left']
1✔
85
                                ?>%" title="<?= $collected['width'] ?>% · From <?=
1✔
86
                                $collected['left'] ?>% to <?=
1✔
87
                                $collected['left'] + $collected['width'] ?>% · From <?=
1✔
88
                                round($collected['start'], 6) ?> to <?= round($collected['end'], 6) ?> second"></span>
1✔
89
                                    </td>
90
                                </tr>
91
                            <?php endforeach ?>
92
                            </tbody>
1✔
93
                        </table>
1✔
94
                    <?php
1✔
95
endif
96
?>
97
                </div>
6✔
98
            </div>
6✔
99
        </div>
6✔
100
        <?php foreach ($collections as $collection): ?>
6✔
101
            <?php if ($collection->hasCollectors()): ?>
2✔
102
                <div class="panel <?= $collection->getSafeName() ?>-collection">
2✔
103
                    <div class="resize" title="Change panel height"></div>
104
                    <header>
105
                        <div class="title">
106
                            <span class="title-icon"><?= $collection->getIcon() ?></span>
2✔
107
                            <span class="title-name"><?= $collection->getName() ?></span>
2✔
108
                        </div>
109
                        <div class="actions"><?= implode(' ', $collection->getActions()) ?></div>
2✔
110
                        <div class="collectors">
111
                            <?php
112
        $collectors = $collection->getCollectors();
2✔
113
                ?>
114
                            <select title="<?= $collection->getSafeName() ?> collectors"<?=
2✔
115
                count($collectors) === 1 ? ' disabled' : '' ?>>
2✔
116
                                <?php foreach ($collectors as $collector): ?>
2✔
117
                                    <option value="<?= $collector->getSafeName() ?>"><?= $collector->getName() ?></option>
2✔
118
                                <?php endforeach ?>
119
                            </select>
2✔
120
                        </div>
2✔
121
                    </header>
2✔
122
                    <div class="contents">
2✔
123
                        <?php foreach ($collection->getCollectors() as $collector): ?>
2✔
124
                            <div class="collector-<?= $collector->getSafeName() ?>"><?= $collector->getContents() ?></div>
2✔
125
                        <?php endforeach ?>
126
                    </div>
2✔
127
                </div>
2✔
128
            <?php endif ?>
2✔
129
        <?php endforeach ?>
2✔
130
    </div>
6✔
131
    <div class="toolbar">
6✔
132
        <div class="icon">
6✔
133
            <img src="data:image/png;base64,<?= base64_encode((string) file_get_contents($iconPath)) ?>" alt="A+" width="32" height="32">
6✔
134
        </div>
135
        <div class="collections">
136
            <?php foreach ($collections as $collection): ?>
6✔
137
                <?php if ($collection->hasCollectors()): ?>
2✔
138
                    <button class="collection" id="<?= $collection->getSafeName() ?>-collection"
2✔
139
                        title="<?= $collection->getName() ?> Collection">
2✔
140
                        <span class="collection-icon"><?= $collection->getIcon() ?></span>
2✔
141
                        <span class="collection-name"><?= $collection->getName() ?></span>
2✔
142
                    </button>
143
                <?php endif ?>
144
            <?php endforeach ?>
2✔
145
            <div class="info">
6✔
146
                <button class="collection" id="info-collection" title="Info Collection">
6✔
147
                    <span class="collection-icon"><?= $infoIcon ?></span>
6✔
148
                    <span class="collection-name">Info</span>
149
                </button>
150
            </div>
151
        </div>
152
    </div>
153
</div>
154
<script>
155
    window.Prism = {};
156
    Prism.manual = true;
157
    <?= file_get_contents(__DIR__ . '/../assets/prism.js') ?>
6✔
158
    Prism.highlightAllUnder(document.querySelector('#debugbar .panels'));
6✔
159
</script>
160
<script>
161
    <?= file_get_contents(__DIR__ . '/scripts.js') ?>
6✔
162
    Debugbar.init();
6✔
163
</script>
164
<!-- Aplus Framework Debugbar end -->
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc