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

aplus-framework / debug / 15692156074

16 Jun 2025 09:13PM UTC coverage: 97.436%. Remained the same
15692156074

push

github

natanfelles
Add link to aplus-framework.com

0 of 1 new or added line in 1 file covered. (0.0%)

570 of 585 relevant lines covered (97.44%)

3.27 hits per line

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

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