X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FGenerate%2FModuleFileCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FGenerate%2FModuleFileCommand.php;h=09653d294ba6992312a7df35957509369e429195;hp=3b08b740d35591143f5530e08f772e5e8c3d5cee;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/drupal/console/src/Command/Generate/ModuleFileCommand.php b/vendor/drupal/console/src/Command/Generate/ModuleFileCommand.php index 3b08b740d..09653d294 100644 --- a/vendor/drupal/console/src/Command/Generate/ModuleFileCommand.php +++ b/vendor/drupal/console/src/Command/Generate/ModuleFileCommand.php @@ -10,13 +10,12 @@ namespace Drupal\Console\Command\Generate; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; -use Drupal\Console\Core\Command\Shared\CommandTrait; +use Drupal\Console\Core\Command\Command; use Drupal\Console\Generator\ModuleFileGenerator; use Drupal\Console\Command\Shared\ConfirmationTrait; use Drupal\Console\Command\Shared\ModuleTrait; use Drupal\Console\Extension\Manager; -use Drupal\Console\Core\Style\DrupalStyle; +use Drupal\Console\Utils\Validator; /** * Class ModuleFileCommand @@ -25,20 +24,24 @@ use Drupal\Console\Core\Style\DrupalStyle; */ class ModuleFileCommand extends Command { - use CommandTrait; use ConfirmationTrait; use ModuleTrait; /** - * @var Manager -*/ + * @var Manager + */ protected $extensionManager; /** - * @var ModuleFileGenerator -*/ + * @var ModuleFileGenerator + */ protected $generator; + /** + * @var Validator + */ + protected $validator; + /** * ModuleFileCommand constructor. @@ -48,10 +51,12 @@ class ModuleFileCommand extends Command */ public function __construct( Manager $extensionManager, - ModuleFileGenerator $generator + ModuleFileGenerator $generator, + Validator $validator ) { $this->extensionManager = $extensionManager; $this->generator = $generator; + $this->validator = $validator; parent::__construct(); } @@ -64,7 +69,12 @@ class ModuleFileCommand extends Command ->setName('generate:module:file') ->setDescription($this->trans('commands.generate.module.file.description')) ->setHelp($this->trans('commands.generate.module.file.help')) - ->addOption('module', null, InputOption::VALUE_REQUIRED, $this->trans('commands.common.options.module')); + ->addOption( + 'module', + null, + InputOption::VALUE_REQUIRED, + $this->trans('commands.common.options.module') + )->setAliases(['gmf']); } /** @@ -72,21 +82,18 @@ class ModuleFileCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - - // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration - if (!$this->confirmGeneration($io, $yes)) { + // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmOperation + if (!$this->confirmOperation()) { return 1; } $machine_name = $input->getOption('module'); $file_path = $this->extensionManager->getModule($machine_name)->getPath(); - $generator = $this->generator; - $generator->generate( - $machine_name, - $file_path - ); + $this->generator->generate([ + 'machine_name' => $machine_name, + 'file_path' => $file_path, + ]); } @@ -95,16 +102,7 @@ class ModuleFileCommand extends Command */ protected function interact(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); - // --module option - $module = $input->getOption('module'); - - if (!$module) { - // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion - $module = $this->moduleQuestion($io); - } - - $input->setOption('module', $module); + $this->getModuleOption(); } }