public function getNamesForDomain($domain) { if (!isset($this->templates[$domain])) { throw new \InvalidArgumentException(sprintf('Unknown template domain "%s"', $domain)); } return array_keys($this->templates[$domain]); }
public function initialize(ConsoleCommandEvent $event) { $command = $event->getCommand(); if ($command instanceof TemplateFeature) { $input = $event->getInput(); $template = $input->getOption('template'); if ($template) { $validTemplates = $this->templateHelper->getNamesForDomain($command->getTemplateDomain()); if (!in_array($template, $validTemplates, true)) { throw new \InvalidArgumentException(sprintf('The specified template "%s" does not exist, try one of: ' . PHP_EOL . ' - %s', $template, implode(PHP_EOL . ' - ', $validTemplates))); } } } }