ChainNormalizer::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 2
1
<?php declare(strict_types=1);
2
3
namespace Mgid\Component\Pagination\Normalizer;
4
5
final class ChainNormalizer extends AbstractNormalizer
6
{
7
    /**
8
     * @var NormalizerInterface[]
9
     */
10
    private array $normalizers;
11
12
    /**
13
     * @param NormalizerInterface[] $normalizers
14
     */
15
    public function __construct(array $normalizers)
16
    {
17
        $this->normalizers = $normalizers;
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    protected function process($value, string $operator)
24
    {
25
        foreach ($this->normalizers as $normalizer) {
26
            $value = $normalizer->normalize($value, $operator);
27
        }
28
29
        return $value;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected function supportsNormalization($value, string $operator): bool
36
    {
37
        return \is_scalar($value);
38
    }
39
}
40