Improved if statements reducing indentation

This commit is contained in:
Alejandro Celaya 2017-07-06 17:38:16 +02:00
parent 23922f6c7b
commit c05aeabdee
3 changed files with 12 additions and 21 deletions

View file

@ -24,14 +24,11 @@ class ApplicationConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
{ {
$this->printTitle($output, 'APPLICATION'); $this->printTitle($output, 'APPLICATION');
if ($appConfig->hasApp()) { if ($appConfig->hasApp() && $this->questionHelper->ask($input, $output, new ConfirmationQuestion(
$keepConfig = $this->questionHelper->ask($input, $output, new ConfirmationQuestion(
'<question>Do you want to keep imported application config? (Y/n):</question> ' '<question>Do you want to keep imported application config? (Y/n):</question> '
)); ))) {
if ($keepConfig) {
return; return;
} }
}
$appConfig->setApp([ $appConfig->setApp([
'SECRET' => $this->ask( 'SECRET' => $this->ask(

View file

@ -25,14 +25,11 @@ class LanguageConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
{ {
$this->printTitle($output, 'LANGUAGE'); $this->printTitle($output, 'LANGUAGE');
if ($appConfig->hasLanguage()) { if ($appConfig->hasLanguage() && $this->questionHelper->ask($input, $output, new ConfirmationQuestion(
$keepConfig = $this->questionHelper->ask($input, $output, new ConfirmationQuestion(
'<question>Do you want to keep imported language? (Y/n):</question> ' '<question>Do you want to keep imported language? (Y/n):</question> '
)); ))) {
if ($keepConfig) {
return; return;
} }
}
$appConfig->setLanguage([ $appConfig->setLanguage([
'DEFAULT' => $this->questionHelper->ask($input, $output, new ChoiceQuestion( 'DEFAULT' => $this->questionHelper->ask($input, $output, new ChoiceQuestion(

View file

@ -24,14 +24,11 @@ class UrlShortenerConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
{ {
$this->printTitle($output, 'URL SHORTENER'); $this->printTitle($output, 'URL SHORTENER');
if ($appConfig->hasUrlShortener()) { if ($appConfig->hasUrlShortener() && $this->questionHelper->ask($input, $output, new ConfirmationQuestion(
$keepConfig = $this->questionHelper->ask($input, $output, new ConfirmationQuestion(
'<question>Do you want to keep imported URL shortener config? (Y/n):</question> ' '<question>Do you want to keep imported URL shortener config? (Y/n):</question> '
)); ))) {
if ($keepConfig) {
return; return;
} }
}
// Ask for URL shortener params // Ask for URL shortener params
$appConfig->setUrlShortener([ $appConfig->setUrlShortener([