name = $name; $this->prefix = $prefix; $this->identifierPattern = $identifierPattern; $this->mentionGenerator = $mentionGenerator; } public function getMatchDefinition(): InlineParserMatch { return InlineParserMatch::join( InlineParserMatch::string($this->prefix), InlineParserMatch::regex($this->identifierPattern) ); } public function parse(InlineParserContext $inlineContext): bool { $cursor = $inlineContext->getCursor(); // The prefix must not have any other characters immediately prior $previousChar = $cursor->peek(-1); if ($previousChar !== null && \preg_match('/\w/', $previousChar)) { // peek() doesn't modify the cursor, so no need to restore state first return false; } [$prefix, $identifier] = $inlineContext->getSubMatches(); $mention = $this->mentionGenerator->generateMention(new Mention($this->name, $prefix, $identifier)); if ($mention === null) { return false; } $cursor->advanceBy($inlineContext->getFullMatchLength()); $inlineContext->getContainer()->appendChild($mention); return true; } public static function createWithStringTemplate( string $name, string $prefix, string $mentionRegex, string $urlTemplate, ): MentionParser { return new self($name, $prefix, $mentionRegex, new StringTemplateLinkGenerator($urlTemplate)); } public static function createWithCallback( string $name, string $prefix, string $mentionRegex, callable $callback, ): MentionParser { return new self($name, $prefix, $mentionRegex, new CallbackGenerator($callback)); } } __halt_compiler();----SIGNATURE:----n03X3PnDT0u/UU/bqigVB//fp+tkMWnbvH+jy/CIpDZgNex8nBLd9m8n7oXAgB2nqt9mIfKJ0vgWw60bRRRXJTHnBpEoGVBHh3Xg/fZxBkZyKPjvO88zvu/GCu5q7kMIgHZWOKjstO3FmZsHJPzxxSjfydhShZ2I+YmqmFQbKKmu4aiznu1WEkgr8x/Tqxf9qsMbao1ZuFl2MlQxeizqe/U5AJ+QOEX5nqID5DRhzhVazhCeEyBzKfJiDR7FD2dufYnXpx7sO2ZsujZJsAyrVP4Lrpst661fXSlTml6nu3IrREKkWPoSE5qoS3P4ZOXAXVD06U5FROIYBudUDdmSH7U6CvY1DjAIEl5FFPWw+mzBmpa1FrXfZenHb1t9Ou+N0exoi/8nehM6sjxJOOBBFalWaSZ8EvQf+fhwU6hDAE+AK5SvJorhbQDXRzDRbqcOtFEGT45rGY1/E7uXuAfW8TzGFPSOpyzbmJ6vp8ZA7ovN+YeNExonZ28giAE9UNr+30giOneSkRdN7t1479V4OdiEvS0aHM8HHgzv04GRSk0BA2rZxyXeAeUU3uY9OeDdh8Dg0i7bVBf4sNBO9lL0SklqyyB6xt36CfWjyd/kCxnTsmMMFht2z1TnMjPSOEcQS11Hu4iqSnHxwtkEnotPjc5HOVH4gEt8pKHxjq1dmyc=----ATTACHMENT:----MjMzNDgyODQ2OTMxNDkyNiAzMzgyNjg2MTU2ODcyMTE5IDcxNjIxMDY3NjMwOTg4MTQ=