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

aplus-framework / debug / 5102359423

pending completion
5102359423

push

github

natanfelles
Add Debugger::roundVersion method

513 of 515 relevant lines covered (99.61%)

2.61 hits per line

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

100.0
/src/Views/exceptions/development.php
1
<?php
2
/**
3
 * @var Exception $exception
4
 * @var Framework\Debug\ExceptionHandler $handler
5
 */
6

7
use Framework\Helpers\ArraySimple;
8

9
?>
10
<!doctype html>
2✔
11
<html lang="<?= $handler->getLanguage()->getCurrentLocale() ?>" dir="<?= $handler->getLanguage()
2✔
12
    ->getCurrentLocaleDirection() ?>">
2✔
13
<head>
14
    <meta charset="utf-8">
15
    <meta name="viewport" content="width=device-width, initial-scale=1">
16
    <title><?= $handler->getLanguage()->render('debug', 'exception') ?>: <?=
2✔
17
        htmlentities($exception->getMessage()) ?></title>
2✔
18
    <style>
19
        <?= file_get_contents(__DIR__ . '/../assets/prism-aplus.css') ?>
2✔
20
    </style>
2✔
21
    <style>
22
        body {
23
            background-color: #000;
24
            color: #fff;
25
            font-family: Arial, Helvetica, sans-serif;
26
            font-size: 16px;
27
            margin: 0 0 20px;
28
        }
29

30
        header {
31
            background: #f00;
32
            border: solid #222;
33
            border-width: 1px 0;
34
            color: #fff;
35
            padding: 20px 20px;
36
        }
37

38
        h1, h2, h3 {
39
            margin: 0 0 5px;
40
        }
41

42
        section {
43
            border-bottom: 1px solid #222;
44
            padding: 10px 20px;
45
        }
46

47
        section:last-of-type {
48
            border-bottom: 0;
49
        }
50

51
        section .header {
52
            background: #f00;
53
            border: 1px solid red;
54
            color: #fff;
55
            font-weight: bold;
56
            padding: 10px;
57
        }
58

59
        .top {
60
            border-top: 0;
61
        }
62

63
        .file {
64
            background: #111;
65
        }
66

67
        .file div {
68
            display: inline-block;
69
        }
70

71
        .file div.line {
72
            margin-left: 10px;
73
        }
74

75
        dl {
76
            background-color: #000;
77
            border: 1px solid #222;
78
            font-family: monospace;
79
            font-size: 14px;
80
            margin: 10px 0 0;
81
        }
82

83
        dt {
84
            background: #111;
85
            border-bottom: 1px solid #222;
86
            color: #fff;
87
            padding: 1%;
88
            width: 98%;
89
        }
90

91
        dd {
92
            background: #000;
93
            margin: 0;
94
            overflow-x: auto;
95
        }
96

97
        pre.code {
98
            display: inline-block;
99
            float: left;
100
            line-height: 20px;
101
            margin: 0;
102
            padding: 5px;
103
            width: 80%;
104
        }
105

106
        dd div {
107
            background: #111;
108
            border-right: 1px solid #222;
109
            display: inline-block;
110
            float: left;
111
            line-height: 20px;
112
            min-width: 25px;
113
            padding: 5px;
114
            text-align: right;
115
            white-space: pre;
116
        }
117

118
        dd div span {
119
            color: #f00;
120
            font-weight: bold;
121
        }
122

123
        dt span {
124
            background: #f00;
125
            padding: 2px 6px;
126
        }
127

128
        table {
129
            border: 1px solid #222;
130
            border-bottom: 0;
131
            border-spacing: 0;
132
            margin-top: 10px;
133
            width: 100%;
134
        }
135

136
        th {
137
            border-right: 2px solid #222;
138
        }
139

140
        th, td {
141
            border-bottom: 1px solid #222;
142
            padding: 5px;
143
        }
144

145
        td pre code {
146
            margin: 0;
147
            white-space: pre-wrap !important;
148
        }
149

150
        tr:hover {
151
            background: #111;
152
        }
153

154
        thead th {
155
            background: #111;
156
            border-bottom: 2px solid #222;
157
            border-right: 0;
158
            color: #fff;
159
            font-size: 110%;
160
            text-align: left;
161
        }
162

163
        tbody th {
164
            background: #111;
165
            min-width: 40%;
166
            text-align: right;
167
        }
168
    </style>
169
</head>
170
<body class="aplus-debug">
171
<header class="top">
172
    <small><?= $handler->getLanguage()->render('debug', 'exception') ?>:</small>
2✔
173
    <h1><?= $exception::class ?></h1>
2✔
174
    <small><?= $handler->getLanguage()->render('debug', 'message') ?>:</small>
2✔
175
    <h2><?= htmlentities($exception->getMessage()) ?></h2>
2✔
176
</header>
177
<section class="file">
178
    <div>
179
        <small><?= $handler->getLanguage()->render('debug', 'file') ?>:</small>
2✔
180
        <h3><?= htmlentities($exception->getFile()) ?></h3>
2✔
181
    </div>
182
    <div class="line">
183
        <small><?= $handler->getLanguage()->render('debug', 'line') ?>:</small>
2✔
184
        <h3><?= $exception->getLine() ?></h3>
2✔
185
    </div>
186
</section>
187
<section class="trace">
188
    <div class="header"><?= $handler->getLanguage()->render('debug', 'trace') ?>:</div>
2✔
189
    <?php
190
    $traces = $exception->getTrace();
2✔
191
if ($traces
2✔
192
    && isset($traces[0]['file'])
2✔
193
    && ($traces[0]['file'] !== $exception->getFile()
2✔
194
        || (isset($traces[0]['line']) && $traces[0]['line'] !== $exception->getLine()))
2✔
195
) {
196
    $traces = array_reverse($traces);
2✔
197
    $traces[] = [
2✔
198
        'file' => $exception->getFile(),
2✔
199
        'line' => $exception->getLine(),
2✔
200
    ];
2✔
201
    $traces = array_reverse($traces);
2✔
202
}
203
?>
204
    <?php foreach ($traces as $key => $trace) : ?>
2✔
205
        <?php if (isset($trace['file'])) : ?>
2✔
206
            <?php if (is_readable($trace['file'])) : ?>
2✔
207
                <dl>
2✔
208
                    <dt>
2✔
209
                        <span><?= count($traces) - $key ?></span>
2✔
210
                        <?= $trace['file'] ?><?=
2✔
211
                    isset($trace['line']) ? ':' . $trace['line'] : ''
2✔
212
                ?>
213
                    </dt>
2✔
214
                    <dd>
2✔
215
                        <?php
2✔
216
                $lines = [];
2✔
217
                $pre = '';
2✔
218
                $handle = fopen($trace['file'], 'rb');
2✔
219
                $line = 1;
2✔
220
                while ($handle && ! feof($handle)) {
2✔
221
                    $code = fgets($handle);
2✔
222
                    if (isset($trace['line'])
2✔
223
                        && $line >= ($trace['line'] - 10)
2✔
224
                        && $line <= ($trace['line'] + 10)
2✔
225
                    ) {
226
                        $pre .= rtrim((string) $code) . \PHP_EOL;
2✔
227
                        $lines[] = $line;
2✔
228
                    }
229
                    $line++;
2✔
230
                }
231
                if ($handle) {
2✔
232
                    fclose($handle);
2✔
233
                }
234
                ?>
235
                        <div><?php
2✔
236
                    foreach ($lines as $line) {
2✔
237
                        if (isset($trace['line']) && $line === $trace['line']) {
2✔
238
                            echo '<span>';
2✔
239
                            echo $line . \PHP_EOL;
2✔
240
                            echo '</span>';
2✔
241
                        } else {
242
                            echo $line . \PHP_EOL;
2✔
243
                        }
244
                    }
245
            ?></div>
2✔
246
                        <pre class="code"><code class="language-php"><?= htmlentities($pre) ?></code></pre>
2✔
247
                    </dd>
248
                </dl>
249
            <?php else : ?>
250
                <dl>
2✔
251
                    <dt>
2✔
252
                        <span><?= $key ?></span> File
2✔
253
                        <em><?= $trace['file'] ?></em> is not readable.
2✔
254
                    </dt>
255
                </dl>
256
            <?php endif ?>
257
        <?php endif ?>
2✔
258
    <?php endforeach ?>
2✔
259
</section>
2✔
260
<section class="input">
2✔
261
    <div class="header">Input:</div>
2✔
262
    <?php
2✔
263
    $input = [
2✔
264
        'ENV' => filter_input_array(\INPUT_ENV) ?: [],
2✔
265
        'SERVER' => filter_input_array(\INPUT_SERVER) ?: [],
2✔
266
        'GET' => ArraySimple::convert(filter_input_array(\INPUT_GET) ?: []),
2✔
267
        'POST' => ArraySimple::convert(filter_input_array(\INPUT_POST) ?: []),
2✔
268
        'COOKIE' => filter_input_array(\INPUT_COOKIE) ?: [],
2✔
269
    ];
2✔
270
foreach ($input as &$item) {
2✔
271
    ksort($item);
2✔
272
}
273
unset($item);
2✔
274
?>
275

276
    <?php foreach ($input as $key => $values) : ?>
2✔
277
        <?php
2✔
278
    if (empty($values)) {
2✔
279
        continue;
2✔
280
    }
281
        ?>
282
        <table>
2✔
283
            <thead>
2✔
284
            <tr>
2✔
285
                <th colspan="2"><?= $key ?></th>
2✔
286
            </tr>
287
            </thead>
288
            <tbody>
289
            <?php foreach ($values as $field => $value) : ?>
2✔
290
                <tr>
2✔
291
                    <th><?= htmlentities($field) ?></th>
2✔
292
                    <td><?= htmlentities(is_array($value) ? print_r($value, true) : $value) ?></td>
2✔
293
                </tr>
294
            <?php endforeach ?>
295
            </tbody>
2✔
296
        </table>
2✔
297
    <?php endforeach ?>
2✔
298
</section>
2✔
299
<?php
2✔
300
$log = $handler->getLogger()?->getLastLog();
2✔
301
if ($log): ?>
2✔
302
    <section class="log">
1✔
303
        <div class="header">Log:</div>
1✔
304
        <table>
1✔
305
            <tr>
1✔
306
                <th>Date</th>
1✔
307
                <td><?= date('Y-m-d', $log->time) ?></td>
1✔
308
            </tr>
309
            <tr>
310
                <th>Time</th>
311
                <td><?= date('H:i:s', $log->time) ?></td>
1✔
312
            </tr>
313
            <tr>
314
                <th>Level</th>
315
                <td><?= htmlentities($log->level->name) ?></td>
1✔
316
            </tr>
317
            <tr>
318
                <th>ID</th>
319
                <td><?= htmlentities($log->id) ?></td>
1✔
320
            </tr>
321
            <tr>
322
                <th>Message</th>
323
                <td>
324
                    <pre><code class="language-log"><?= htmlentities($log->message) ?></code></pre>
1✔
325
                </td>
326
            </tr>
327
        </table>
328
    </section>
329
<?php
330
endif ?>
331
<script>
2✔
332
    <?= file_get_contents(__DIR__ . '/../assets/prism.js') ?>
2✔
333
</script>
2✔
334
</body>
2✔
335
</html>
2✔
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