Total Complexity | 8 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 89.47% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class ArrayNormalizer extends AbstractNormalizer |
||
6 | { |
||
7 | /** @var string */ |
||
8 | private $delimiter; |
||
9 | /** @var StringNormalizer */ |
||
10 | private $stringNormalizer; |
||
11 | |||
12 | 2 | public function __construct(?NormalizerInterface $normalizer = null) |
|
13 | { |
||
14 | 2 | $this->setDelimiter(','); |
|
15 | |||
16 | 2 | parent::__construct($normalizer); |
|
17 | 2 | } |
|
18 | |||
19 | 2 | public function normalize(string $value) |
|
20 | { |
||
21 | 2 | return $this->getNormalizedValue($value); |
|
22 | } |
||
23 | |||
24 | 2 | protected function getNormalizedValue(string $value) |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * Sets the delimiter to pass to explode(). Defaults to , (comma). |
||
39 | */ |
||
40 | 2 | public function setDelimiter(string $delimiter): self |
|
48 | } |
||
49 | |||
50 | public function getDelimiter(): string |
||
55 |