Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console / templates / module / src / Command / command.php.twig
1 {% extends "base/class.php.twig" %}
2
3 {% block file_path %}
4 \Drupal\{{extension}}\Command\{{ class }}.
5 {% endblock %}
6
7 {% block namespace_class %}
8 namespace Drupal\{{extension}}\Command;
9 {% endblock %}
10
11 {% block use_class %}
12 use Symfony\Component\Console\Input\InputInterface;
13 use Symfony\Component\Console\Output\OutputInterface;
14 use Symfony\Component\Console\Command\Command;
15 {% if container_aware %}
16 use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait;
17 {% else %}
18 use Drupal\Console\Core\Command\Shared\CommandTrait;
19 {% endif %}
20 use Drupal\Console\Core\Style\DrupalStyle;
21 use Drupal\Console\Annotations\DrupalCommand;
22 {% endblock %}
23
24 {% block class_declaration %}
25 /**
26  * Class {{ class_name }}.
27  *
28  * @package Drupal\{{extension}}
29  *
30  * @DrupalCommand (
31  *     extension="{{extension}}",
32  *     extensionType="{{ extensionType }}"
33  * )
34  */
35 class {{ class_name }} extends Command {% endblock %}
36 {% block class_construct %}
37 {% if services is not empty %}
38
39   /**
40    * Constructs a new {{ class_name }} object.
41    */
42   public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
43 {{ serviceClassInitialization(services) }}
44     parent::__construct();
45   }
46 {% endif %}
47 {% endblock %}
48
49 {% block use_trait %}
50 {% if container_aware %}
51   use ContainerAwareCommandTrait;
52 {% else %}
53   use CommandTrait;
54 {% endif %}
55
56 {% endblock %}
57
58 {% block class_methods %}
59   /**
60    * {@inheritdoc}
61    */
62   protected function configure() {
63     $this
64       ->setName('{{ name }}')
65       ->setDescription($this->trans('commands.{{ command_key }}.description'));
66   }
67
68   /**
69    * {@inheritdoc}
70    */
71   protected function execute(InputInterface $input, OutputInterface $output) {
72     $io = new DrupalStyle($input, $output);
73
74     $io->info($this->trans('commands.{{ command_key }}.messages.success'));
75   }
76 {%- endblock -%}