diff --git a/module/CLI/src/Install/Plugin/ApplicationConfigCustomizerPlugin.php b/module/CLI/src/Install/Plugin/ApplicationConfigCustomizerPlugin.php
index add69c72..232fe048 100644
--- a/module/CLI/src/Install/Plugin/ApplicationConfigCustomizerPlugin.php
+++ b/module/CLI/src/Install/Plugin/ApplicationConfigCustomizerPlugin.php
@@ -18,25 +18,23 @@ class ApplicationConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
* @param OutputInterface $output
* @param CustomizableAppConfig $appConfig
* @return void
- * @throws \Symfony\Component\Console\Exception\RuntimeException
*/
public function process(InputInterface $input, OutputInterface $output, CustomizableAppConfig $appConfig)
{
$io = new SymfonyStyle($input, $output);
$io->title('APPLICATION');
- if ($appConfig->hasApp() && $io->confirm(
- 'Do you want to keep imported application config? (Y/n): '
- )) {
+ if ($appConfig->hasApp() && $io->confirm('Do you want to keep imported application config?')) {
return;
}
$appConfig->setApp([
- 'SECRET' => $this->ask(
- $io,
+ 'SECRET' => $io->ask(
'Define a secret string that will be used to sign API tokens (leave empty to autogenerate one)',
null,
- true
+ function ($value) {
+ return $value;
+ }
) ?: $this->generateRandomString(32),
]);
}
diff --git a/module/CLI/src/Install/Plugin/DatabaseConfigCustomizerPlugin.php b/module/CLI/src/Install/Plugin/DatabaseConfigCustomizerPlugin.php
index 66144ccd..edb843d0 100644
--- a/module/CLI/src/Install/Plugin/DatabaseConfigCustomizerPlugin.php
+++ b/module/CLI/src/Install/Plugin/DatabaseConfigCustomizerPlugin.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install\Plugin;
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
-use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
@@ -35,7 +34,6 @@ class DatabaseConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
* @param CustomizableAppConfig $appConfig
* @return void
* @throws IOException
- * @throws RuntimeException
*/
public function process(InputInterface $input, OutputInterface $output, CustomizableAppConfig $appConfig)
{
diff --git a/module/CLI/src/Install/Plugin/LanguageConfigCustomizerPlugin.php b/module/CLI/src/Install/Plugin/LanguageConfigCustomizerPlugin.php
index 4acee568..5f37fd65 100644
--- a/module/CLI/src/Install/Plugin/LanguageConfigCustomizerPlugin.php
+++ b/module/CLI/src/Install/Plugin/LanguageConfigCustomizerPlugin.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Install\Plugin;
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
-use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
@@ -18,32 +17,24 @@ class LanguageConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
* @param OutputInterface $output
* @param CustomizableAppConfig $appConfig
* @return void
- * @throws RuntimeException
*/
public function process(InputInterface $input, OutputInterface $output, CustomizableAppConfig $appConfig)
{
$io = new SymfonyStyle($input, $output);
$io->title('LANGUAGE');
- if ($appConfig->hasLanguage() && $io->confirm(
- 'Do you want to keep imported language? (Y/n): '
- )) {
+ if ($appConfig->hasLanguage() && $io->confirm('Do you want to keep imported language?')) {
return;
}
$appConfig->setLanguage([
- 'DEFAULT' => $io->choice(
- 'Select default language for the application in general (defaults to '
- . self::SUPPORTED_LANGUAGES[0] . '):',
- self::SUPPORTED_LANGUAGES,
- 0
- ),
- 'CLI' => $io->choice(
- 'Select default language for CLI executions (defaults to '
- . self::SUPPORTED_LANGUAGES[0] . '):',
- self::SUPPORTED_LANGUAGES,
- 0
- ),
+ 'DEFAULT' => $this->chooseLanguage('Select default language for the application in general', $io),
+ 'CLI' => $this->chooseLanguage('Select default language for CLI executions', $io),
]);
}
+
+ private function chooseLanguage(string $message, SymfonyStyle $io): string
+ {
+ return $io->choice($message, self::SUPPORTED_LANGUAGES, self::SUPPORTED_LANGUAGES[0]);
+ }
}
diff --git a/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizerPlugin.php b/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizerPlugin.php
index f457bfa8..2be57759 100644
--- a/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizerPlugin.php
+++ b/module/CLI/src/Install/Plugin/UrlShortenerConfigCustomizerPlugin.php
@@ -5,7 +5,6 @@ namespace Shlinkio\Shlink\CLI\Install\Plugin;
use Shlinkio\Shlink\CLI\Model\CustomizableAppConfig;
use Shlinkio\Shlink\Core\Service\UrlShortener;
-use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
@@ -17,7 +16,6 @@ class UrlShortenerConfigCustomizerPlugin extends AbstractConfigCustomizerPlugin
* @param OutputInterface $output
* @param CustomizableAppConfig $appConfig
* @return void
- * @throws RuntimeException
*/
public function process(InputInterface $input, OutputInterface $output, CustomizableAppConfig $appConfig)
{