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:----BWWtNXaDje8Ni1rJvpxklu2PfIOaLmM0fo2y2/7SoygGbLmOq9pl5tJ7bM5fyieSuimFX5CaG2sGm1oq/UpRUGsTtbEjiP9sElBB64ZdOo9DzZJY8Wf6doaDnEUKb11sRhoZttuIDOxlxQZcA+5o5Euk6MT2kN1RuboAasdazTJxTlO8Kmf9FtwF1QEyFdmk3CHDU/Y0D+6je/wjmSwcUEpdaP1AQiaF87//k5hSxjC+G5xQSjRfSnLaBOJFXL7L9JLVdzz/Y6V7KEGB0/tdRlu/3tMmgGnHQnyh1d1Pn+/dFry9MPDZfN3nag6j0mOyIa1M8SSI4fD2HVtEpC4zT6TTuZtwgeszHDsreAxu1hM8STYK/jxajbV6PMh0z+16B4mYmqrbhlP1ZkI5KJWsOTgLMO9SlPS1K1arlidXM4NccSFhkxxbgK/U11NYq9esDKJ9PslyUj8nQktFToHZQkpVieZhAYdUzBNqQwhC24KH44Rb4faZLxlNVpB6P1blA4Fjz3qsRH14F3SZgmTxyI7+keX+Y4u4iBlKUEEQVL96I498B3kbGmiR4UUefK7JTNau2N4K0aFuzsLEb6bQLHQNDU3gd3N5bhTPeyuXqzczpfEaWfHn8iShldH7zaJmVq6qam5R58NmbaOdhOlGjduf4BWTjY3SHOIskHeFdaI=----ATTACHMENT:----OTgxMTE5MjA4NDUxMjExMyA5Mzk1NjI1NDYwNjg3MDUgMjg0MzgxNTY2MjM3Mjk0OA==