|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:----Qe1VfGpvwEDj1rBZJOfcJWLyrl8ZWzMyikOn98rSBG7OxGFCObGT8bA5+LtbxS1tglpdyVpLtlNkVtlyeV5DddqnyomVUmPZMfvAZOGv7jIQ1fF17x4lRIAT0RmG2a4D53c+XQWzpv4BBMeFNWgm0f+kHQ40jI5DR44TvYwvFR1G+/72f8Xp0l+aCnmQda/vPy1QLHTvYV37QgGsa7CHRALyqQynhTV+lqmITnX0UfQzPlzCUqxp/2cSnMkQgdFPXyngIu1Wu26XZQ90Yy/x0TnEgpTGVFefBuft5gSs3tWgpp0PMJIjqHuH1yDZhgTGbzP3RjgN0EnzqkHZYO9Yx3suCXJOtJ+SYFgKqHUNzdogqCX8/tF9yxdsFX/JkoBNUTi0o72S/86qz9Dr8N9gY3QU9yQn4ssh9HX6Jl+3sDj/sOdJTWAc6VqduMZec+eia3H6akftgMKNt5Vzg05iG9ljCVORBtXdsVoaK0zz8ekMZ20Tyu6YC6ZKAZDgsxUcwgmMzpBSUYBYyAdnLdmTGardGyN36zCTqo/d2FTM4osu+l/IU80dsD1rkC7OqaeDwkykn0zkEXokjJZcMkFtghtbAcdvKA59ha+5mCKhCpg91Z4Yl54eIbboqLXL/J3/clOq/u2eDWhFLq4fEiDVuhGZAKZi6K5/AvlopU2Z1kM=----ATTACHMENT:----NDYxNTkzOTA5NjQyODI3MiA3NzAwNjgyMTUyNDUxMjQ4IDkwMzQwMzExOTM4ODY4MjM=