Conditions | 2 |
Paths | 6 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
17 | 1 | public function process(Parser $parser, $node, $variable, $data, array $options) |
|
18 | { |
||
19 | /** @var CodeNode $node */ |
||
20 | |||
21 | 1 | parent::process($parser, $node, $variable, $data, $options); |
|
22 | |||
23 | try |
||
24 | { |
||
25 | 1 | $highlighter = new Highlighter(); |
|
26 | 1 | $highlighted = $highlighter->highlight($node->getLanguage(), $node->getValue()); |
|
27 | |||
28 | 1 | $nodeOutput = sprintf('<pre><code class="hljs language-%s">%s</code></pre>', $node->getLanguage(), $highlighted->value); |
|
29 | |||
30 | 1 | $node->setRaw(true); |
|
31 | 1 | $node->setValue($nodeOutput); |
|
32 | } |
||
33 | 1 | catch (\Exception $e) |
|
|
|||
34 | { |
||
35 | } |
||
36 | 1 | } |
|
37 | } |
||
38 |