AbstractNormalizer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A normalize() 0 7 2
1
<?php declare(strict_types=1);
2
3
namespace Mgid\Component\Pagination\Normalizer;
4
5
abstract class AbstractNormalizer implements NormalizerInterface
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10
    final public function normalize($value, string $operator)
11
    {
12
        if ($this->supportsNormalization($value, $operator)) {
13
            return $this->process($value, $operator);
14
        }
15
16
        return $value;
17
    }
18
19
    /**
20
     * @param mixed  $value
21
     * @param string $operator
22
     *
23
     * @return mixed
24
     */
25
    abstract protected function process($value, string $operator);
26
27
    /**
28
     * @param mixed  $value
29
     * @param string $operator
30
     *
31
     * @return bool
32
     */
33
    abstract protected function supportsNormalization($value, string $operator): bool;
34
}
35