Strings   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
c 0
b 0
f 0
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 8 2
1
<?php
2
3
namespace Riesenia\Pohoda\Common\OptionsResolver\Normalizers;
4
5
class Strings extends AbstractNormalizer
6
{
7 98
    public function normalize(mixed $options, mixed $value): string
8
    {
9
        // remove new lines
10 98
        $value = \str_replace(["\r\n", "\r", "\n"], ' ', \strval($value));
11
12
        // param is used for string length
13 98
        $length = empty($this->length) ? null : \intval($this->length);
14 98
        return \mb_substr(\strval($value), 0, $length, 'utf-8');
15
    }
16
}
17