Total Complexity | 8 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Coverage | 70% |
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 | 1 | public function __construct(NormalizerInterface $normalizer = null) |
|
13 | { |
||
14 | 1 | $this->stringNormalizer = new StringNormalizer(); |
|
15 | 1 | $this->stringNormalizer->setTrimCharMask($this->stringNormalizer->getTrimCharMask() . $this->delimiter); |
|
16 | |||
17 | 1 | parent::__construct($normalizer); |
|
18 | 1 | } |
|
19 | |||
20 | 1 | public function normalize(string $value) |
|
21 | { |
||
22 | 1 | return $this->getNormalizedValue($value); |
|
23 | } |
||
24 | |||
25 | 1 | protected function getNormalizedValue(string $value) |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * Sets the delimiter to pass to explode(). Defaults to , (comma) |
||
41 | */ |
||
42 | public function setDelimiter(string $delimiter): self |
||
49 | } |
||
50 | |||
51 | public function getDelimiter(): string |
||
56 |