Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
28 | 1 | public function process(Page $page, string $output, string $format): string |
|
29 | { |
||
30 | 1 | if ($format == 'html') { |
|
31 | // https://regex101.com/r/Xl7d5I/3 |
||
32 | 1 | $pattern = '(.*)(<!--[[:blank:]]?(excerpt|break)[[:blank:]]?-->)(.*)'; |
|
33 | 1 | $replacement = '$1<span id="more"></span>$4'; |
|
34 | 1 | $excerpt = preg_replace('/' . $pattern . '/is', $replacement, $output, 1); |
|
35 | 1 | $output = $excerpt ?? $output; |
|
36 | } |
||
37 | |||
38 | 1 | return $output; |
|
39 | } |
||
41 |