Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
51 | public function colorize(string $sql): string |
||
52 | { |
||
53 | // determine specific query type |
||
54 | $type = strtolower(substr($sql, 0, 6)); |
||
55 | if (!in_array($type, ['select', 'update', 'delete', 'insert'])) { |
||
56 | $type = ''; |
||
57 | } |
||
58 | $template = '<span class="reserved">$1</span>'; |
||
59 | $sql = preg_replace(self::$keywordRegex, $template, $sql); |
||
60 | |||
61 | return "<div class='query $type'>$sql</div>"; |
||
62 | } |
||
64 |