3 // @DCG Place this file to $HOME/.dcg/Command{{ path }} directory.
5 namespace {{ namespace }};
7 use DrupalCodeGenerator\Command\BaseGenerator;
8 use DrupalCodeGenerator\Utils;
9 use Symfony\Component\Console\Input\InputInterface;
10 use Symfony\Component\Console\Output\OutputInterface;
11 use Symfony\Component\Console\Question\Question;
14 * Implements {{ name }} command.
16 class {{ class }} extends BaseGenerator {
18 protected $name = '{{ name }}';
19 protected $description = '{{ description }}';
20 protected $alias = '{{ alias }}';
21 protected $templatePath = __DIR__;
26 protected function interact(InputInterface $input, OutputInterface $output) {
27 // Ask the user some questions.
28 $questions = Utils::defaultQuestions();
29 $default_class = function ($vars) {
30 return Utils::camelize($vars['name'] . 'Example');
32 $questions['class'] = new Question('Class', $default_class);
34 $this->collectVars($input, $output, $questions);
36 // @DCG The template should be located under directory specified in
37 // $self::templatePath property.
39 ->path('src/{class}.php')
40 ->template('{{ template_name }}');