Conditions | 3 |
Paths | 4 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php # -*- coding: utf-8 -*- |
||
23 | 5 | public function render(array $content): string |
|
24 | 5 | { |
|
25 | // Define css class for each language. |
||
26 | 5 | $language = !empty($content[3]) ? filter_var($content[3], FILTER_SANITIZE_STRING) : ''; |
|
27 | 5 | $class = !empty($language) ? sprintf(' class="%s language-%s"', $language, $language) : ''; |
|
28 | // Build one block so that we not create each paragraph. |
||
29 | 5 | $content = str_replace("\n", '<br>', $content[4]); |
|
30 | |||
31 | 5 | return sprintf('<pre><code%s>%s</code></pre>', $class, $content); |
|
32 | } |
||
34 |