ListNormalizer::process()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 2
nc 1
nop 2
1
<?php declare(strict_types=1);
2
3
namespace Mgid\Component\Pagination\Normalizer;
4
5
use Mgid\Component\Pagination\Contract\FilterableInterface;
6
7
final class ListNormalizer extends AbstractNormalizer
8
{
9
    /**
10
     * @param mixed  $value
11
     * @param string $operator
12
     *
13
     * @return string[]
14
     */
15
    protected function process($value, string $operator): array
16
    {
17
        return \explode(',', $value) ?: [];
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    protected function supportsNormalization($value, string $operator): bool
24
    {
25
        return \is_string($value) && \in_array($operator, [FilterableInterface::IN, FilterableInterface::NOT_IN], true);
26
    }
27
}
28