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

aplus-framework / debug / 9925298839

24 Apr 2024 07:27PM UTC coverage: 97.253% (-2.4%) from 99.634%
9925298839

push

github

natanfelles
Upgrade helpers library to version 4

531 of 546 relevant lines covered (97.25%)

2.66 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="robots" content="noindex">
16
    <meta name="viewport" content="width=device-width, initial-scale=1">
17
    <title><?= $handler->getLanguage()->render('debug', 'exception') ?>: <?=
2✔
18
        htmlentities($exception->getMessage()) ?></title>
2✔
19
    <style>
20
        <?= file_get_contents(__DIR__ . '/../assets/prism-aplus.css') ?>
2✔
21
    </style>
2✔
22
    <style>
23
        body {
24
            background-color: #000;
25
            color: #fff;
26
            font-family: Arial, Helvetica, sans-serif;
27
            font-size: 16px;
28
            margin: 0 0 20px;
29
        }
30

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

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

43
        h2 a {
44
            color: inherit;
45
            text-decoration: none;
46
        }
47

48
        h2 a:hover {
49
            color: inherit;
50
            text-decoration: underline;
51
        }
52

53
        section {
54
            border-bottom: 1px solid #222;
55
            padding: 10px 20px;
56
        }
57

58
        section:last-of-type {
59
            border-bottom: 0;
60
        }
61

62
        section .header {
63
            background: #f00;
64
            border: 1px solid red;
65
            color: #fff;
66
            font-weight: bold;
67
            padding: 10px;
68
        }
69

70
        .top {
71
            border-top: 0;
72
        }
73

74
        .file {
75
            background: #111;
76
        }
77

78
        .file div {
79
            display: inline-block;
80
        }
81

82
        .file div.line {
83
            margin-left: 10px;
84
        }
85

86
        dl {
87
            background-color: #000;
88
            border: 1px solid #222;
89
            font-family: monospace;
90
            font-size: 14px;
91
            margin: 10px 0 0;
92
        }
93

94
        dt {
95
            background: #111;
96
            border-bottom: 1px solid #222;
97
            color: #fff;
98
            padding: 1%;
99
            width: 98%;
100
        }
101

102
        dd {
103
            background: #000;
104
            margin: 0;
105
            overflow-x: auto;
106
        }
107

108
        pre.code {
109
            display: inline-block;
110
            float: left;
111
            line-height: 20px;
112
            margin: 0;
113
            padding: 5px;
114
            width: 80%;
115
        }
116

117
        dd div {
118
            background: #111;
119
            border-right: 1px solid #222;
120
            display: inline-block;
121
            float: left;
122
            line-height: 20px;
123
            min-width: 25px;
124
            padding: 5px;
125
            text-align: right;
126
            white-space: pre;
127
        }
128

129
        dd div span {
130
            color: #f00;
131
            font-weight: bold;
132
        }
133

134
        dt span {
135
            background: #f00;
136
            padding: 2px 6px;
137
        }
138

139
        table {
140
            border: 1px solid #222;
141
            border-bottom: 0;
142
            border-spacing: 0;
143
            margin-top: 10px;
144
            width: 100%;
145
        }
146

147
        th {
148
            border-right: 2px solid #222;
149
        }
150

151
        th, td {
152
            border-bottom: 1px solid #222;
153
            padding: 5px;
154
        }
155

156
        td pre code {
157
            margin: 0;
158
            white-space: pre-wrap !important;
159
        }
160

161
        tr:hover {
162
            background: #111;
163
        }
164

165
        thead th {
166
            background: #111;
167
            border-bottom: 2px solid #222;
168
            border-right: 0;
169
            color: #fff;
170
            font-size: 110%;
171
            text-align: left;
172
        }
173

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

293
    <?php foreach ($input as $key => $values) : ?>
2✔
294
        <?php
2✔
295
    if (empty($values)) {
2✔
296
        continue;
2✔
297
    }
298
        ?>
299
        <table>
2✔
300
            <thead>
2✔
301
            <tr>
2✔
302
                <th colspan="2"><?= $key ?></th>
2✔
303
            </tr>
304
            </thead>
305
            <tbody>
306
            <?php foreach ($values as $field => $value) : ?>
2✔
307
                <tr>
2✔
308
                    <th><?= htmlentities($field) ?></th>
2✔
309
                    <td><?= htmlentities(is_array($value) ? print_r($value, true) : $value) ?></td>
2✔
310
                </tr>
311
            <?php endforeach ?>
312
            </tbody>
2✔
313
        </table>
2✔
314
    <?php endforeach ?>
2✔
315
</section>
2✔
316
<?php
2✔
317
$log = $handler->getLogger()?->getLastLog();
2✔
318
if ($log): ?>
2✔
319
    <section class="log">
1✔
320
        <div class="header">Log:</div>
1✔
321
        <table>
1✔
322
            <tr>
1✔
323
                <th>Date</th>
1✔
324
                <td><?= date('Y-m-d', $log->time) ?></td>
1✔
325
            </tr>
326
            <tr>
327
                <th>Time</th>
328
                <td><?= date('H:i:s', $log->time) ?></td>
1✔
329
            </tr>
330
            <tr>
331
                <th>Level</th>
332
                <td><?= htmlentities($log->level->name) ?></td>
1✔
333
            </tr>
334
            <tr>
335
                <th>ID</th>
336
                <td><?= htmlentities($log->id) ?></td>
1✔
337
            </tr>
338
            <tr>
339
                <th>Message</th>
340
                <td>
341
                    <pre><code class="language-log"><?= htmlentities($log->message) ?></code></pre>
1✔
342
                </td>
343
            </tr>
344
        </table>
345
    </section>
346
<?php
347
endif ?>
348
<script>
2✔
349
    <?= file_get_contents(__DIR__ . '/../assets/prism.js') ?>
2✔
350
</script>
2✔
351
</body>
2✔
352
</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