SpecialEntitiesToPlaceholdersForView   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 23
ccs 20
cts 20
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 21 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * @author domenico [email protected] / [email protected]
5
 * Date: 05/11/18
6
 * Time: 16.23
7
 *
8
 */
9
10
namespace Matecat\SubFiltering\Filters;
11
12
use Matecat\SubFiltering\Commons\AbstractHandler;
13
use Matecat\SubFiltering\Enum\ConstantEnum;
14
15
class SpecialEntitiesToPlaceholdersForView extends AbstractHandler {
16
17 53
    public function transform( string $segment ): string {
18
19 53
        return (string)str_ireplace(
20 53
                [
21 53
                        '&#10;', '&#13;', ' ' /* NBSP in ascii value */,
22 53
                        '&#x0A;', '&#x0C;',
23 53
                        '&#160;', '&#xA0;',
24 53
                        '&#09;', '&#9;', '&#x09;'
25 53
                ],
26 53
                [
27 53
                        ConstantEnum::lfPlaceholder,
28 53
                        ConstantEnum::crPlaceholder,
29 53
                        ConstantEnum::nbspPlaceholder,
30 53
                        ConstantEnum::lfPlaceholder,
31 53
                        ConstantEnum::crPlaceholder,
32 53
                        ConstantEnum::nbspPlaceholder,
33 53
                        ConstantEnum::nbspPlaceholder,
34 53
                        ConstantEnum::tabPlaceholder,
35 53
                        ConstantEnum::tabPlaceholder,
36 53
                        ConstantEnum::tabPlaceholder,
37 53
                ], $segment );
38
39
    }
40
41
}