Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Debug | |
0.00% |
0 / 14 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| sql | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| asString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| html | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| html_dump | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Projom\Util; |
| 6 | |
| 7 | class Debug |
| 8 | { |
| 9 | public static function sql(string $sql, string $lb = "\n"): string |
| 10 | { |
| 11 | $output = preg_split( |
| 12 | '/(SELECT|UPDATE|INSERT INTO|VALUES|INNER JOIN|LEFT JOIN|RIGHT JOIN|STRAIGHT JOIN|ON|FROM|WHERE)/', |
| 13 | $sql, |
| 14 | -1, |
| 15 | \PREG_SPLIT_NO_EMPTY | \PREG_SPLIT_DELIM_CAPTURE |
| 16 | ); |
| 17 | return implode($lb, $output); |
| 18 | } |
| 19 | |
| 20 | public static function asString(array $subject): string |
| 21 | { |
| 22 | return var_export($subject); |
| 23 | } |
| 24 | |
| 25 | public static function html($subject): void |
| 26 | { |
| 27 | echo '<pre>'; |
| 28 | print_r($subject); |
| 29 | echo '</pre>'; |
| 30 | } |
| 31 | |
| 32 | public static function html_dump($subject): void |
| 33 | { |
| 34 | echo '<pre>'; |
| 35 | var_dump($subject); |
| 36 | echo '</pre>'; |
| 37 | } |
| 38 | } |