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,13 +24,10 @@ 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> ' ))) {
)); return;
if ($keepConfig) {
return;
}
} }
$appConfig->setApp([ $appConfig->setApp([

View file

@ -25,13 +25,10 @@ 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> ' ))) {
)); return;
if ($keepConfig) {
return;
}
} }
$appConfig->setLanguage([ $appConfig->setLanguage([

View file

@ -24,13 +24,10 @@ 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> ' ))) {
)); return;
if ($keepConfig) {
return;
}
} }
// Ask for URL shortener params // Ask for URL shortener params