Integers   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 14
c 0
b 0
f 0
dl 0
loc 20
ccs 16
cts 16
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 18 3
1
<?php
2
3
namespace Riesenia\Pohoda\Common\OptionsResolver\Normalizers;
4
5
class Integers extends AbstractNormalizer
6
{
7 52
    public function normalize(mixed $options, mixed $value): string
8
    {
9 52
        $preform = \strval(
10 52
            \preg_replace(
11 52
                '/[^0-9,.-]/',
12 52
                '',
13 52
                \strval($value),
14 52
            ),
15 52
        );
16 52
        if ($this->nullable && empty(\strlen($preform))) {
17 1
            return '';
18
        }
19 52
        return \strval(
20 52
            \intval(
21 52
                \str_replace(
22 52
                    ',',
23 52
                    '.',
24 52
                    $preform,
25 52
                ),
26 52
            ),
27 52
        );
28
    }
29
}
30