| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 38 | protected function visit(\DOMNode $el) |
||
| 39 | { |
||
| 40 | static $formats = [ |
||
| 41 | 'comment' => "\033[0;34;40m%s\033[0m", |
||
| 42 | 'default' => "\033[0;32;40m%s\033[0m", |
||
| 43 | 'keyword' => "\033[0;31;40m%s\033[0m", |
||
| 44 | 'string' => "\033[0;33;40m%s\033[0m", |
||
| 45 | ]; |
||
| 46 | |||
| 47 | $type = $el instanceof \DOMElement ? $el->getAttribute('data-type') : 'raw'; |
||
| 48 | $text = \str_replace([' ', '<', '>'], [' ', '<', '>'], $el->textContent); |
||
| 49 | |||
| 50 | $this->out .= \sprintf($formats[$type] ?? '%s', $text); |
||
| 51 | } |
||
| 53 |