EncodeControlCharsInXliff   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
c 0
b 0
f 0
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 9 1
1
<?php
2
3
namespace Matecat\SubFiltering\Filters;
4
5
use Matecat\SubFiltering\Commons\AbstractHandler;
6
7
class EncodeControlCharsInXliff extends AbstractHandler {
8
9
    /**
10
     * @inheritDoc
11
     */
12 11
    public function transform( string $segment ): string {
13 11
        return str_replace(
14 11
                [ "\r\n", "\r", "\n", "\t" ],
15 11
                [
16 11
                        '&#13;&#10;',
17 11
                        '&#13;',
18 11
                        '&#10;',
19 11
                        '&#09;'
20 11
                ], $segment );
21
    }
22
}
23