ChainNormalizer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 0
f 0
dl 0
loc 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 7 2
A __construct() 0 3 1
A supportsNormalization() 0 3 1
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