addSchema('mentions', Expect::arrayOf( Expect::structure([ 'prefix' => Expect::string()->required(), 'pattern' => Expect::string()->assert($isAValidPartialRegex, 'Pattern must not include starting/ending delimiters (like "/")')->required(), 'generator' => Expect::anyOf( Expect::type(MentionGeneratorInterface::class), Expect::string(), Expect::type('callable') )->required(), ]) )); } public function register(EnvironmentBuilderInterface $environment): void { $mentions = $environment->getConfiguration()->get('mentions'); foreach ($mentions as $name => $mention) { if ($mention['generator'] instanceof MentionGeneratorInterface) { $environment->addInlineParser(new MentionParser($name, $mention['prefix'], $mention['pattern'], $mention['generator'])); } elseif (\is_string($mention['generator'])) { $environment->addInlineParser(MentionParser::createWithStringTemplate($name, $mention['prefix'], $mention['pattern'], $mention['generator'])); } elseif (\is_callable($mention['generator'])) { $environment->addInlineParser(MentionParser::createWithCallback($name, $mention['prefix'], $mention['pattern'], $mention['generator'])); } else { throw new InvalidConfigurationException(\sprintf('The "generator" provided for the "%s" MentionParser configuration must be a string template, callable, or an object that implements %s.', $name, MentionGeneratorInterface::class)); } } } } __halt_compiler();----SIGNATURE:----D8uMOrNUML8EY7OgJrJB6Eb+CcWRlFXLtunXu+GahFiDcDKkPFUOR0f620Lj4EwKlKF3yDWp0UKkDKk2ufbffIc2KqmCd+3VOoBmNCyJUZ+OZTK35ImpmYmdsQLj+bPBO2183vZTi8N6rkREWKQ4qod11kKHIJOzYSDRMW3oNWt9N9IzW4e3dXkrff3PiG/xpoeXEdT1qSaxjcYfvhCeabG0XzdOZxYq8uXn+wTezrEtEohkYvwKenl8ZduWXugSQ/QbtsHrnhZxYCBOSjalTa9Xhg0Zeyq02RaCpaxRGsNiACfeuCBOYSpT3RUgKdUUK7UhuECZs5u4zzF/rEh5wYNQv4/VhTTtx9jeaphb4gtrSChsxFhdutIUsxCR9dwB65OninhLlD70JCrQtXre2Mwtu+N3qQ004HT9lbjYKKCi4uUANveKh7PCw8pG/7feVy8uwk5ys2J/EYwxORDu864eCrYFc9q/CdBuPuIcdJR943+qZklP+HatoieGSXXeb5JNV4XfC/SoQ8GUAfbzMCG+t0zLpU+bS2n+JKYCFhEMtvLOm8T5ei69yQ6P1g6q50lkAgejzPPJRYj5PrsCket8ONeLx+ZD3xCgNHQRkI5F4D2WVG2G+vWPVMXLvTr8BlLA6ZQbZx9MifM7EoKVNdr37OisTQaEsXgzowDaWdg=----ATTACHMENT:----Mzg1MTk4MjY3NjAzMjAzIDc1OTMwMTExODk0MzcxNDkgOTQyOTM1Mzc2MzE3NDg4NA==