3 namespace DrupalCodeGenerator\Command\Drupal_8\Service;
5 use DrupalCodeGenerator\Command\BaseGenerator;
6 use DrupalCodeGenerator\Utils;
7 use Symfony\Component\Console\Input\InputInterface;
8 use Symfony\Component\Console\Output\OutputInterface;
11 * Implements d8:service:middleware command.
13 class Middleware extends BaseGenerator {
15 protected $name = 'd8:service:middleware';
16 protected $description = 'Generates a middleware';
17 protected $alias = 'middleware';
22 protected function interact(InputInterface $input, OutputInterface $output) {
23 $questions = Utils::defaultQuestions();
24 $vars = &$this->collectVars($input, $output, $questions);
25 $vars['class'] = Utils::camelize($vars['name']) . 'Middleware';
28 ->path('src/{class}.php')
29 ->template('d8/service/middleware.twig');
31 $this->addServicesFile()
32 ->path('{machine_name}.services.yml')
33 ->template('d8/service/middleware.services.twig');