Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
EchoLogger | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
log | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |||
ln | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace WebPConvert\Loggers; |
4 | |
5 | /** |
6 | * Echo the logs immediately (in HTML) |
7 | * |
8 | * @package WebPConvert |
9 | * @author Bjørn Rosell <it@rosell.dk> |
10 | * @since Class available since Release 2.0.0 |
11 | */ |
12 | class EchoLogger extends BaseLogger |
13 | { |
14 | |
15 | /** |
16 | * Handle log() by echoing the message. |
17 | * |
18 | * @param string $msg message to log |
19 | * @param string $style style (null | bold | italic) |
20 | * @return void |
21 | */ |
22 | public function log($msg, $style = '') |
23 | { |
24 | $msg = htmlspecialchars($msg); |
25 | if ($style == 'bold') { |
26 | echo '<b>' . $msg . '</b>'; |
27 | } elseif ($style == 'italic') { |
28 | echo '<i>' . $msg . '</i>'; |
29 | } else { |
30 | echo $msg; |
31 | } |
32 | } |
33 | |
34 | /** |
35 | * Handle ln by echoing a <br> tag. |
36 | * |
37 | * @return void |
38 | */ |
39 | public function ln() |
40 | { |
41 | echo '<br>'; |
42 | } |
43 | } |