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:----Z3jMnmxImHJY2nagj5vP3gnCQ4GXtzqO4fMf1Gw1mbcvtk3vaAMrvavw7fluV446UV+g2Zl2HVxQE26SCqKcFVIMc143wKepP0Gp1gjhG2iKNk5ei88iRYD22ASEShuCCCWulaeqDiAnk2x8Th9zR1Fg4GKZOyKkmW3uDS4lAM5yfTTZKqscZ9ZiFUet/UdW6JgCbkQW4xltc2z5vWNC6l1jpMrQiXCszoveqCmZMbMm9voClKGKBhcFEJUcQr7T1d5SyLKlvzZtYOfb4Ku6ATqZQigwqru28haAT6nXe6HuMS2LVaatPy/fOztmFfQKR8sL6t2l2QQ33CiFgcPKR6hM46cZVXWKvQycHKPc6VdmZVwwgDYUVTYIjhGdW7ZZE3b5hdR2yMTiaNlEVJi5KAkluO9c959C/eQAcSqitxNcgVJdEIoEOVmb/E3C7xg1+k6sh+xnblAQid5bC9tArGEUzK1L12VT0EEnrYx0vwxT17K2prfyjoi8/gqs11iq407F/4hYXtIINFORNuCqZLaVbz87HamIt5tQios08L/woyy/0a/c8Tc23CuyPFWXSMSinI/4H4Rc+I2IAxA8KBPZyiR5K+oy2Wi9dObteqXUX7gAYHsLvpVqQnXRofDdx2JWKljcziJl2g4jgHVrOLEtoEKUs45jJVyyNG+iP1o=----ATTACHMENT:----MzYwMDY0MDU1NDE3NDcwNSAxNjI3MDU1MjI3NzY2NDYgMzA0NDcwODczMjI1NzIwNA==