Booleans::normalize()   B
last analyzed

Complexity

Conditions 7
Paths 7

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 7

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 8.8333
cc 7
nc 7
nop 2
crap 7
1
<?php
2
3
namespace Riesenia\Pohoda\Common\OptionsResolver\Normalizers;
4
5
class Booleans extends AbstractNormalizer
6
{
7 40
    public function normalize(mixed $options, mixed $value): string
8
    {
9 40
        if ($this->nullable && empty($value) && !\is_bool($value)) {
10 1
            return '';
11
        }
12 40
        return !$value || \is_string($value) && 'false' === \strtolower($value) ? 'false' : 'true';
13
    }
14
}
15