1 | <?php |
||
20 | final class DelimiterProcessorCollection implements DelimiterProcessorCollectionInterface |
||
21 | { |
||
22 | private $processorsByChar = []; |
||
23 | |||
24 | 2037 | public function add(DelimiterProcessorInterface $processor) |
|
25 | { |
||
26 | 2037 | if (isset($this->processorsByChar[$processor->getCharacter()])) { |
|
27 | 3 | throw new \InvalidArgumentException(sprintf('Delim processor for character "%s" already exists', $processor->getCharacter())); |
|
28 | } |
||
29 | |||
30 | 2037 | $this->processorsByChar[$processor->getCharacter()] = $processor; |
|
31 | 2037 | } |
|
32 | |||
33 | 846 | public function getDelimiterProcessor(string $char): ?DelimiterProcessorInterface |
|
37 | } |
||
38 |