CtrlCharsPlaceHoldToAscii   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 8 1
1
<?php
2
3
namespace Matecat\SubFiltering\Filters;
4
5
use Matecat\SubFiltering\Commons\AbstractHandler;
6
use Matecat\SubFiltering\Enum\ConstantEnum;
7
8
class CtrlCharsPlaceHoldToAscii extends AbstractHandler {
9
10 38
    public function transform( string $segment ): string {
11
12
        //Replace br placeholders
13 38
        $segment = str_replace( ConstantEnum::crlfPlaceholder, "\r\n", $segment );
14 38
        $segment = str_replace( ConstantEnum::lfPlaceholder, "\n", $segment );
15 38
        $segment = str_replace( ConstantEnum::crPlaceholder, "\r", $segment );
16
17 38
        return str_replace( ConstantEnum::tabPlaceholder, "\t", $segment );
18
19
    }
20
21
}