*/ private ArrayCollection $strings; public function __construct(int $fenceLength, string $fenceChar, int $fenceOffset) { $this->block = new FencedCode($fenceLength, $fenceChar, $fenceOffset); $this->strings = new ArrayCollection(); } public function getBlock(): FencedCode { return $this->block; } public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue { // Check for closing code fence if (! $cursor->isIndented() && $cursor->getNextNonSpaceCharacter() === $this->block->getChar()) { $match = RegexHelper::matchFirst('/^(?:`{3,}|~{3,})(?= *$)/', $cursor->getLine(), $cursor->getNextNonSpacePosition()); if ($match !== null && \strlen($match[0]) >= $this->block->getLength()) { // closing fence - we're at end of line, so we can finalize now return BlockContinue::finished(); } } // Skip optional spaces of fence offset // Optimization: don't attempt to match if we're at a non-space position if ($cursor->getNextNonSpacePosition() > $cursor->getPosition()) { $cursor->match('/^ {0,' . $this->block->getOffset() . '}/'); } return BlockContinue::at($cursor); } public function addLine(string $line): void { $this->strings[] = $line; } public function closeBlock(): void { // first line becomes info string $firstLine = $this->strings->first(); if ($firstLine === false) { $firstLine = ''; } $this->block->setInfo(RegexHelper::unescape(\trim($firstLine))); if ($this->strings->count() === 1) { $this->block->setLiteral(''); } else { $this->block->setLiteral(\implode("\n", $this->strings->slice(1)) . "\n"); } } } __halt_compiler();----SIGNATURE:----OG2/Xp5vwYLsY8nmZlO64s/KzTRnZzF4tnmpykPsbCd0MFcVdR43m0ZR+JsxUIzzmMiYws2nS4YyxJhZqJwDRMbCTHA2+JSD4zwq9HGISf+EILA5qCrvJm3UOvktiSG0e8CDMzBZZspkoYkyH9+Ichnv+VujoY0Bql3/EXEJ/0RE/5IfB7i+zbHcG4pNWKu+QknXu/NO5IP18eNmZT0PHoRguvE8Gp5fJKmLcn5Cm6rN3y5rBBmHVKIALn2lV/BgdKGQkltvujkkKfEohe40o3ZEi+tu22UALIXp43RkDAgHycxLf/OmS/zY2xtTdclS2uBoH2dJgZ2S0qydes4ZgJ1i5Jwbkmg0v1PhGrSn88CmiHNSHB6XLjnM0DDQD0sDikpuGmZb9PtAPZml/QZOn4MpRClGB3H+fjHrgV12oEAH1teOVGoHpwdF9GeKTbcV5OXDPC4NDJYYHbLL4DVHAaDG9i2gM0fnKjbb854FmwFlk//+kRpu6yScct6fB3x2KSra4hUGZ1hLebF90LywD7YZmEGO7t//vxF59DKpkUM3lNW/v6OHFpeQPfT8k2KcSFjBYrfUwLvhNL1KO9lbPecu0u8HKgiTPkohsIjSZaTlgx9Ar9pvniDqTkzzDUc2qyh4/D67EDErcIR+mX8T4enF/w2wQANFAB7eq0zENXs=----ATTACHMENT:----MTA0MTEzNjExMDM1NTM4NiAyMjMyOTU2Mzk5MDcyNTc1IDU0MDQ3MjIwNzY1Mzk5MTM=