Conditions | 6 |
Paths | 18 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 13.776 |
Changes | 0 |
1 | <?php |
||
31 | 462 | public function debugMessage($message, $encoding=null) |
|
32 | { |
||
33 | // US-ASCII is a warning for PHP and a fatal for HHVM |
||
34 | 462 | if ($encoding == 'US-ASCII') { |
|
35 | $encoding = 'UTF-8'; |
||
36 | } |
||
37 | |||
38 | 462 | if (PHP_SAPI != 'cli') { |
|
39 | $flags = ENT_COMPAT; |
||
40 | // avoid warnings on php < 5.4... |
||
41 | if (defined('ENT_HTML401')) { |
||
42 | $flags = $flags | ENT_HTML401; |
||
43 | } |
||
44 | if (defined('ENT_SUBSTITUTE')) { |
||
45 | $flags = $flags | ENT_SUBSTITUTE; |
||
46 | } |
||
47 | if ($encoding != null) { |
||
|
|||
48 | print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>"; |
||
49 | } else { |
||
50 | print "<PRE>\n".htmlentities($message, $flags)."\n</PRE>"; |
||
51 | } |
||
52 | } else { |
||
53 | 462 | print "\n$message\n"; |
|
54 | } |
||
55 | |||
56 | // let the user see this now in case there's a time out later... |
||
57 | 462 | flush(); |
|
58 | 462 | } |
|
59 | } |
||
60 |