Passed
Push — master ( 22bc6e...3fff97 )
by Dev
13:34
created

HtmlBeautifer::punctuationBeautifer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 6
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace PiedWeb\CMSBundle\Utils;
4
5
class HtmlBeautifer
6
{
7
    public static function removeHtmlComments(string $content)
8
    {
9
        return preg_replace('/<!--(.|\s)*?-->/', '', $content);
10
    }
11
12
    public static function punctuationBeautifer($text)
13
    {
14
        return str_replace(
15
            [' ;', ' :', ' ?', ' !', '« ', ' »', '&laquo; ', ' &raquo;'],
16
            ['&nbsp;;', '&nbsp;:', '&nbsp;?', '&nbsp;!', '«&nbsp;', '&nbsp;»', '&laquo;&nbsp;', '&nbsp;&raquo;'],
17
            $text
18
        );
19
    }
20
}
21