|DelimiterProcessorInterface[] * * @psalm-readonly-allow-private-mutation */ private array $processors = []; public function __construct(string $char, DelimiterProcessorInterface $processor) { $this->delimiterChar = $char; $this->add($processor); } public function getOpeningCharacter(): string { return $this->delimiterChar; } public function getClosingCharacter(): string { return $this->delimiterChar; } public function getMinLength(): int { return $this->minLength; } /** * Adds the given processor to this staggered delimiter processor * * @throws InvalidArgumentException if attempting to add another processors for the same character and minimum length */ public function add(DelimiterProcessorInterface $processor): void { $len = $processor->getMinLength(); if (isset($this->processors[$len])) { throw new InvalidArgumentException(\sprintf('Cannot add two delimiter processors for char "%s" and minimum length %d', $this->delimiterChar, $len)); } $this->processors[$len] = $processor; \krsort($this->processors); $this->minLength = \min($this->minLength, $len); } public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int { return $this->findProcessor($opener->getLength())->getDelimiterUse($opener, $closer); } public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void { $this->findProcessor($delimiterUse)->process($opener, $closer, $delimiterUse); } private function findProcessor(int $len): DelimiterProcessorInterface { // Find the "longest" processor which can handle this length foreach ($this->processors as $processor) { if ($processor->getMinLength() <= $len) { return $processor; } } // Just use the first one in our list $first = \reset($this->processors); \assert($first instanceof DelimiterProcessorInterface); return $first; } } __halt_compiler();----SIGNATURE:----dqM/oQeBEHU1mvKJatidHJwsKw1h9mlEHIxMlbveuuzsG+Fx7bCKK1NhC6hHpnguszQxo19OLnkz9UJm/2ZWElxYdpj8GRMLV+CJO0aQIAvUZLEl1AXHO/KQAWfEjYWzEtt1a1AUBLEJtNREOVF5POdQ4Z/PgV0cV4N57TQ7zDT/H5lV+w8mwA2btT1ruTi0Gm92GHFyUfQXtf8rnhORDt476mkJQ1NjkP8F3DIJqqBn1K0cw5V2c+Achm/EknnN667o2M/vLQ9sNRQ/eqC6ZXVUURJf4aAR5tMSfFTh1DfuW3GCb/rplIYpA/DdDKv7jtZZ/0vYGKM46+xMor0y6EHREuYFdqVS7T7yuMSZZsnXsqLREr6PgR4QccevgcfK4JEZWWpPDvOHi07waaaNsuypANvcxxGIlEo8kXps4Q9yg8qP0pRiVfGW61WlTmNUkhWhAicZv6F4bBy10UsmhHKCSSWFE+Esz5f6/P3NJJ/ccztYNBEdXQym0bjrn3DMKAdnCUuoZQwAeLlbw0+QgaF0iPbTBF3F0cN3eu5OSsEuZKFLXzb9nzVA3Fg/eJDwKdppeSdkpcK+NlI41OwlHGfpGbnXA4eEvMZWFKv8o52dvbBDhAt7LOyKb7pKz8NS1WOKbqkpQD+x+Bna8TLCYt5Ncox1L5XRSpRD3BbTfps=----ATTACHMENT:----MTA4MzEzMzM3NDI5MTMxOSA3ODM1NDE1NjAzNzkxMTg4IDcwMjY0NzI4MDIyMzI4MTU=