|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:----TlQnNuITv04t+EzGY4/MQDVub2IRcD8bDieIF2Np0JmY4hkwvPIS3nxFuKY1fGxnOaZVNg47ekrSaRb74larqyZtMM43c4vHVlO7DLgikK/U9borYplaYlBSlMPAr1QPI9WFTHkS1cBf5ymdWoc2HBS+gWwD8LbNRbxjqJ9kzs2XQIa1PG1ntuzSRP37UO7IvotMRW2WDmMnod+uJLNTHoOiEQ03yy6ZV6WddB+WeAA68y9atLOg/Ir4GYepTBR7uDp+xb8RBeUT+vyDSPCTmmoVzhYZZDHFA90iC8m8Xtvwi9bPsNM+h1a5prKEUY1/34tj1CB4SktP3amoU4HXothiZ5NP9bx7nEdyQwHHF0+1+PZEq/6VJilnwmeucS8xReduNC9R+CY5nu0Fl06fxycc3qrsSGtz1F4l73jn4XekO1cCc/QdW4APok4XUSd0SIKThsnwbM2VDNLs6g9h2ZY6JxuLt0hUN29x17ZokKk2lpbHYiFogOLSH8FeINCAlHUlaIA0anNNo0nU+5TicwPloX65Q/nkK3ztwlrk2V33Mj0pemFRHe5NE46/TkK91pIpjYNfQq81IQ58wWhD5uW7Gvh+ulbOQ/akPhv9wpB7my3C/UgVDYmuSvVI/8Al+sACNEgppoT7WTVpjDY8iMJyIoT9u3BpVF6bM1zPT+c=----ATTACHMENT:----NzI3NTEwOTE1MDgyODgxNSAxMzQ2OTQyODE1MDIxOTIxIDQxOTY5OTM4OTgxNDM2OTA=