Version 1
[yaffs-website] / vendor / drupal / console / templates / module / src / Command / command.php.twig
diff --git a/vendor/drupal/console/templates/module/src/Command/command.php.twig b/vendor/drupal/console/templates/module/src/Command/command.php.twig
new file mode 100644 (file)
index 0000000..3050957
--- /dev/null
@@ -0,0 +1,76 @@
+{% extends "base/class.php.twig" %}
+
+{% block file_path %}
+\Drupal\{{extension}}\Command\{{ class }}.
+{% endblock %}
+
+{% block namespace_class %}
+namespace Drupal\{{extension}}\Command;
+{% endblock %}
+
+{% block use_class %}
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Command\Command;
+{% if container_aware %}
+use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait;
+{% else %}
+use Drupal\Console\Core\Command\Shared\CommandTrait;
+{% endif %}
+use Drupal\Console\Core\Style\DrupalStyle;
+use Drupal\Console\Annotations\DrupalCommand;
+{% endblock %}
+
+{% block class_declaration %}
+/**
+ * Class {{ class_name }}.
+ *
+ * @package Drupal\{{extension}}
+ *
+ * @DrupalCommand (
+ *     extension="{{extension}}",
+ *     extensionType="{{ extensionType }}"
+ * )
+ */
+class {{ class_name }} extends Command {% endblock %}
+{% block class_construct %}
+{% if services is not empty %}
+
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
+{{ serviceClassInitialization(services) }}
+    parent::__construct();
+  }
+{% endif %}
+{% endblock %}
+
+{% block use_trait %}
+{% if container_aware %}
+  use ContainerAwareCommandTrait;
+{% else %}
+  use CommandTrait;
+{% endif %}
+
+{% endblock %}
+
+{% block class_methods %}
+  /**
+   * {@inheritdoc}
+   */
+  protected function configure() {
+    $this
+      ->setName('{{ name }}')
+      ->setDescription($this->trans('commands.{{ command_key }}.description'));
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function execute(InputInterface $input, OutputInterface $output) {
+    $io = new DrupalStyle($input, $output);
+
+    $io->info($this->trans('commands.{{ command_key }}.messages.success'));
+  }
+{%- endblock -%}