EncodeControlCharsInXliff::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 7
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 9
ccs 9
cts 9
cp 1
crap 1
rs 10
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