-
Notifications
You must be signed in to change notification settings - Fork 4
/
BasicDisplay.php
72 lines (65 loc) · 1.59 KB
/
BasicDisplay.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php /**
* Wano: reports raised PHP error messages (mainly warnings and notices)
*
* @author Kaloyan Tsvetkov (KT) <[email protected]>
* @package Wano
* @link https://github.com/kktsvetkov/wano/
* @license http://opensource.org/licenses/LGPL-3.0 GNU Lesser General Public License, version 3.0
*/
namespace Wano\Display;
/**
* A Simpler Display Adapter
*/
class BasicDisplay implements DisplayInterface
{
protected static $levels = array(
E_ERROR => 'error',
E_WARNING => 'warning',
E_PARSE => 'error',
E_NOTICE => 'notice',
E_CORE_ERROR => 'error',
E_CORE_WARNING => 'warning',
E_COMPILE_ERROR => 'error',
E_COMPILE_WARNING => 'warning',
E_USER_ERROR => 'error',
E_USER_WARNING => 'warning',
E_USER_NOTICE => 'notice',
E_STRICT => 'strict',
E_RECOVERABLE_ERROR => 'error',
E_DEPRECATED => 'deprecated',
E_USER_DEPRECATED => 'deprecated',
);
/**
* @inherit
*/
public function show(array $logs)
{
echo '<div style="background:khaki; margin:1em; padding:1em">';
foreach ($logs as $log)
{
echo '<div style="margin-bottom: 1em">';
echo '<p>';
echo '<span style="background:black;color:white">PHP ',
isset(self::$levels[$log[1]])
? self::$levels[$log[1]]
: 'unknown',
'</span> ';
echo '<em>"',
htmlspecialchars($log[2]),
'"</em>';
if ($log[0] > 1)
{
echo ' <b>(', $log[0], ' times)</b> ';
}
echo ' at <u>', $log[3], ':', $log[4], '</u>';
echo '</p>';
if (isset($log[5]))
{
echo '<pre style="margin-left:1em">',
htmlspecialchars($log[5]), '</pre>';
}
echo '</div>';
}
echo '</div>';
}
}