Skip to content

Commit

Permalink
Replace module unput call without params (#3681)
Browse files Browse the repository at this point in the history
* Add validator of HTTP methods. Move list of http methods to separate method and add settings for it. Change twig template to generate the methods based on HTTP methods accrodingly

* Replace moduleFromInput call without params

* Rename moduleFromInput to getModuleOPtion
  • Loading branch information
LOBsTerr authored and jmolivas committed Jan 11, 2018
1 parent 44facf3 commit 0935cdc
Show file tree
Hide file tree
Showing 42 changed files with 46 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/Command/Config/ExportContentTypeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --content-type argument
$contentType = $input->getArgument('content-type');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Config/ExportSingleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
}

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();
if ($module) {
$optionalConfig = $input->getOption('optional');
if (!$optionalConfig) {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Config/ExportViewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// view-id argument
$viewId = $input->getArgument('view-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/AjaxCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/AuthenticationProviderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$stringUtils = $this->stringConverter;

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/CacheContextCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

// --cache_context option
$cache_context = $input->getOption('cache-context');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/ControllerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

// --class option
$class = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/EntityBundleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --bundle-name option
$bundleName = $input->getOption('bundle-name');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/EntityCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$utils = $this->stringConverter;

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --entity-class option
$entityClass = $input->getOption('entity-class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/EventSubscriberCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

// --service-name option
$name = $input->getOption('name');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/FormAlterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --form-id option
$formId = $input->getOption('form-id');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/FormCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

// --class option
$className = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/HelpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$this->site->loadLegacyFile('/core/includes/schema.inc');

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

$description = $input->getOption('description');
if (!$description) {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/JsTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/ModuleFileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();
}
}
2 changes: 1 addition & 1 deletion src/Command/Generate/PermissionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --permissions option
$permissions = $input->getOption('permissions');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginBlockCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$themeRegions = \system_region_list($theme, REGIONS_VISIBLE);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginCKEditorButtonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginConditionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$entity_types = $entityTypeRepository->getEntityTypeLabels(true);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginFieldCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --type-class option
$typeClass = $input->getOption('type-class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginFieldFormatterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginFieldTypeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginFieldWidgetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginImageEffectCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginImageFormatterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginMailCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginMigrateProcessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// 'module-name' option.
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

// 'class-name' option
$class = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginMigrateSourceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// 'module-name' option.
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

$class = $input->getOption('class');
if (!$class) {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginRestResourceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginRulesActionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginSkeletonCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

$pluginId = $input->getOption('plugin-id');
if (!$pluginId) {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginTypeAnnotationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginTypeYamlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PluginViewsFieldCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

// --class option
$class_name = $input->getOption('class');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/PostUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$this->site->loadLegacyFile('/core/includes/schema.inc');

// --module option
$this->moduleFromInput($io, $input);
$this->getModuleOption();

$postUpdateName = $input->getOption('post-update-name');
if (!$postUpdateName) {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/RouteSubscriberCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

// --name option
$name = $input->getOption('name');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/ServiceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

//--name option
$name = $input->getOption('name');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/TwigExtensionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

// --name option
$name = $input->getOption('name');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Generate/UpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$this->site->loadLegacyFile('/core/includes/schema.inc');

// --module option
$module = $this->moduleFromInput($io, $input);
$module = $this->getModuleOption();

$lastUpdateSchema = $this->getLastUpdate($module);
$nextUpdateSchema = $lastUpdateSchema ? ($lastUpdateSchema + 1): 8001;
Expand Down
4 changes: 1 addition & 3 deletions src/Command/Module/InstallDependencyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ protected function configure()
*/
protected function interact(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);

$module = $input->getArgument('module');
if (!$module) {
// @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
$module = $this->moduleQuestion($io);
$module = $this->moduleQuestion();
$input->setArgument('module', $module);
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/Command/Module/PathCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
*/
protected function interact(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);

// --module argument
$module = $input->getArgument('module');
if (!$module) {
// @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
$module = $this->moduleQuestion($io);
$module = $this->moduleQuestion();
$input->setArgument('module', $module);
}
}
Expand Down
Loading

0 comments on commit 0935cdc

Please sign in to comment.