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:----pPaggNEa7/M2M/U2x6eA23VQOg2EaFMdV/ya4WExC1lsAqkFcmFVE6T249sAiWbq857DtLo2zxl8oTDi2DdzYXqXo+eAo4b5syO8j5Jv1h404Tg2Cp5V3B2tNfSPrTNPG2PiFK38HtSc4UkVC2fyZmcPqOoKTiU6WsvEwyf7aJHinnyDLgTkUjYee50N0GXFepdwHcsd+U+XhShNPhqYiHyIxyXl1kXCbViCz3wpZvSL9mG9sLXfqMTq6G5Q6QTf94h+ZPUmBOQg89MW7laHtxeSh/98qOfzgPF2zqt0x6sx3HY+YqY628xHCJYRN8lEfbNjpO6z2ZmMzrqHKCPIhyDjw2Imx+i3hnnQCkcvY16qAlfe4IYPTEJuZEyV1+ssJzLl7h1MYBcA1mib893XfiVP3EpefvB0z3QxdqIgTtebleRb5PeLX1b3FWvZV+pRz1AjTMRCPpLaW2NRCuj67Z5VcIbSADa7WAhQAkvPyT8AGtbqbBH7Sbp4CRfErRBQDA43Qq50fEWDH24N0m7aE8liiThAVHRSDhmPmeoCpVunOYRkBPN/KmPqxLkXrOCU2FooSa40ip+ltSRF84Fmx0hsUWs8q3VxaXm3S1abZAXxorhsv5DLwsxmFrOeuLpc4r0Fk8h73hbVlLcv+WNL0GyuAyPlKzMRXdbXhH/9P8U=----ATTACHMENT:----NDkyOTY2ODkzMzI1MzU0NiA4NTMzMjAyNzE1NDE4OTM1IDcyODY5NjkyNjg4NzkxNjQ=