Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / src / Command / Drupal_8 / Service / EventSubscriber.php
diff --git a/vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/EventSubscriber.php b/vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/Service/EventSubscriber.php
new file mode 100644 (file)
index 0000000..03ae74e
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+namespace DrupalCodeGenerator\Command\Drupal_8\Service;
+
+use DrupalCodeGenerator\Command\BaseGenerator;
+use DrupalCodeGenerator\Utils;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Implements d8:service:event-subscriber command.
+ */
+class EventSubscriber extends BaseGenerator {
+
+  protected $name = 'd8:service:event-subscriber';
+  protected $description = 'Generates an event subscriber';
+  protected $alias = 'event-subscriber';
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function interact(InputInterface $input, OutputInterface $output) {
+    $questions = Utils::defaultQuestions();
+
+    $vars = &$this->collectVars($input, $output, $questions);
+    $vars['class'] = Utils::camelize($vars['name'] . 'Subscriber');
+
+    $this->addFile()
+      ->path('src/EventSubscriber/{class}.php')
+      ->template('d8/service/event-subscriber.twig');
+
+    $this->addServicesFile()
+      ->template('d8/service/event-subscriber.services.twig');
+  }
+
+}