Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
25 | public static function description(string $text): string |
||
26 | { |
||
27 | $text = nl2br($text); |
||
28 | $text = str_replace(["\n", "\n\r", "\r\n", "\r"], '', $text); |
||
29 | |||
30 | $text = preg_replace_callback('/<json><br \/>(.*?)<\/json>/s', function ($item) { |
||
31 | $s = '<br><pre class="apiDocu-json">' . str_replace('<br>', '', end($item)) . '</pre>'; |
||
32 | $s = preg_replace('/(\s)"([^"]+)"/', '$1<span class="apiDocu-string">"$2"</span>', $s); |
||
33 | $s = preg_replace('/\/\/(.*?)<br \/>/', '<span class="apiDocu-comment">//$1</span><br>', $s); |
||
34 | |||
35 | return $s; |
||
36 | }, $text); |
||
37 | |||
38 | $text = preg_replace('/\*\*([^*]*)\*\*/', '<strong>$1</strong>', $text); |
||
39 | |||
40 | return (string) $text; |
||
41 | } |
||
42 | } |
||
43 |