Skip to content

Commit

Permalink
[console] Fix ModuleTrait class. (#3650)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolivas authored Jan 7, 2018
1 parent 7780d2c commit cacaa08
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions src/Command/Shared/ModuleTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Drupal\Console\Command\Shared;

use Drupal\Console\Core\Style\DrupalStyle;
use Symfony\Component\Console\Input\InputInterface;

/**
* Class ModuleTrait
Expand Down Expand Up @@ -87,35 +88,35 @@ public function moduleRequirement(array $module, DrupalStyle $io)
}
}

/**
* Get module name from user.
*
* @param \Drupal\Console\Core\Style\DrupalStyle $io
* Console interface.
* @param \Drupal\Console\Command\Shared\InputInterface $input
* Input interface.
* @throws \Exception
* When module is not found.
*/
/**
* Get module name from user.
*
* @param \Drupal\Console\Core\Style\DrupalStyle $io
* Console interface.
* @param InputInterface $input
* Input interface.
* @throws \Exception
* When module is not found.
*/
public function moduleFromInput( DrupalStyle $io, InputInterface $input) {
$module = $input->getOption('module');
if (!$module) {
// @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
$module = $this->moduleQuestion($io);
$input->setOption('module', $module);
}
else {
$missing_modules = $this->validator->getMissingModules([$module]);
if ($missing_modules) {
throw new \Exception(
sprintf(
$this->trans(
'commands.module.download.messages.no-releases'
),
$module
)
);
$module = $input->getOption('module');
if (!$module) {
// @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
$module = $this->moduleQuestion($io);
$input->setOption('module', $module);
}
else {
$missing_modules = $this->validator->getMissingModules([$module]);
if ($missing_modules) {
throw new \Exception(
sprintf(
$this->trans(
'commands.module.download.messages.no-releases'
),
$module
)
);
}
}
}
}
}

0 comments on commit cacaa08

Please sign in to comment.