/** * Indexing available method and function invocations, target: l, p, $this->translate() * functions. * * @param InvocationLocatorInterface $locator */ public function indexInvocations(InvocationLocatorInterface $locator) { $this->logger()->info("Indexing invocations of 'l' function."); $this->registerInvocations($locator->getInvocations(new \ReflectionFunction('l'))); $this->logger()->info("Indexing invocations of 'p' function."); $this->registerInvocations($locator->getInvocations(new \ReflectionFunction('p'))); $this->logger()->info("Indexing invocations of 'say' method (TranslatorTrait)."); $this->registerInvocations($locator->getInvocations(new \ReflectionMethod(TranslatorTrait::class, 'say'))); $this->translator->getCatalogue()->saveDomains(); }
/** * @param Indexer $indexer * @param InvocationLocatorInterface $invocationLocator * @param ClassLocatorInterface $classLocator */ public function perform(Indexer $indexer, InvocationLocatorInterface $invocationLocator, ClassLocatorInterface $classLocator) { if ($invocationLocator instanceof LoggerAwareInterface) { //Way too much verbosity $invocationLocator->setLogger(new NullLogger()); } if ($classLocator instanceof LoggerAwareInterface) { //Way too much verbosity $classLocator->setLogger(new NullLogger()); } $this->writeln("<info>Scanning translate function usages...</info>"); $indexer->indexInvocations($invocationLocator); $this->writeln("<info>Scanning Translatable classes...</info>"); $indexer->indexClasses($classLocator); }