1111use Symfony \Component \Console \Input \InputOption ;
1212use Symfony \Component \Console \Output \OutputInterface ;
1313use Symfony \Component \Console \Style \SymfonyStyle ;
14- use Symfony \Component \Uid \Ulid ;
1514
1615#[AsCommand(
1716 name: 'app:utils:convert-config-json-to-env ' ,
@@ -33,17 +32,18 @@ final protected function execute(InputInterface $input, OutputInterface $output)
3332
3433 if (!in_array ($ type , ['admin ' , 'client ' ])) {
3534 $ io ->error ('Invalid type ' );
35+
3636 return Command::INVALID ;
3737 }
3838
3939 $ content = file_get_contents ($ input ->getArgument ('filepath ' ));
4040
4141 $ config = json_decode ($ content , true );
4242
43- if ($ type === ' admin ' ) {
44- $ io ->info (" Insert the following lines in .env.local: " );
43+ if (' admin ' === $ type ) {
44+ $ io ->info (' Insert the following lines in .env.local: ' );
4545
46- $ rejseplanenApiKey = $ config ['rejseplanenApiKey ' ] ?? "" ;
46+ $ rejseplanenApiKey = $ config ['rejseplanenApiKey ' ] ?? '' ;
4747 $ showScreenStatus = var_export ($ config ['showScreenStatus ' ] ?? false , true );
4848 $ touchButtonRegions = var_export ($ config ['touchButtonRegions ' ] ?? false , true );
4949 $ enhancedPreview = var_export (!empty ($ config ['previewClient ' ]), true );
@@ -55,35 +55,35 @@ final protected function execute(InputInterface $input, OutputInterface $output)
5555 }
5656
5757 $ env = "###> Admin configuration ### \n" ;
58- $ env .= " ADMIN_REJSEPLANEN_APIKEY= \"" . $ rejseplanenApiKey . "\"\n" ;
59- $ env .= " ADMIN_SHOW_SCREEN_STATUS= " . $ showScreenStatus . "\n" ;
60- $ env .= " ADMIN_TOUCH_BUTTON_REGIONS= " . $ touchButtonRegions . "\n" ;
61- $ env .= "ADMIN_LOGIN_METHODS=' " . json_encode ($ loginMethods ) . "' \n" ;
62- $ env .= " ADMIN_ENHANCED_PREVIEW= " . $ enhancedPreview . "\n" ;
58+ $ env .= ' ADMIN_REJSEPLANEN_APIKEY=" ' . $ rejseplanenApiKey. "\"\n" ;
59+ $ env .= ' ADMIN_SHOW_SCREEN_STATUS= ' . $ showScreenStatus. "\n" ;
60+ $ env .= ' ADMIN_TOUCH_BUTTON_REGIONS= ' . $ touchButtonRegions. "\n" ;
61+ $ env .= "ADMIN_LOGIN_METHODS=' " . json_encode ($ loginMethods ). "' \n" ;
62+ $ env .= ' ADMIN_ENHANCED_PREVIEW= ' . $ enhancedPreview. "\n" ;
6363 $ env .= "###< Admin configuration ### \n" ;
6464
6565 $ output ->writeln ($ env );
66- } else if ( $ type === ' client ' ) {
66+ } elseif ( ' client ' === $ type ) {
6767 $ env = "Insert the following lines in .env.local: \n\n\n" ;
6868
6969 $ loginCheckTimeout = $ config ['loginCheckTimeout ' ] ?? 20000 ;
7070 $ refreshTokenTimeout = $ config ['refreshTokenTimeout ' ] ?? 300000 ;
7171 $ releaseTimestampIntervalTimeout = $ config ['releaseTimestampIntervalTimeout ' ] ?? 600000 ;
7272 $ schedulingInterval = $ config ['schedulingInterval ' ] ?? 60000 ;
73- $ pullStrategyInterval = $ config ['dataStrategy ' ][" config " ]['interval ' ] ?? 90000 ;
73+ $ pullStrategyInterval = $ config ['dataStrategy ' ][' config ' ]['interval ' ] ?? 90000 ;
7474 $ debug = var_export ($ config ['debug ' ] ?? false , true );
7575
7676 $ colorScheme = $ config ['colorScheme ' ] ?? null ;
77- $ colorSchemeValue = $ colorScheme !== null ? "' " . json_encode ($ colorScheme ) . "' " : "" ;
77+ $ colorSchemeValue = null !== $ colorScheme ? "' " . json_encode ($ colorScheme ). "' " : '' ;
7878
7979 $ env .= "###> Client configuration ### \n" ;
80- $ env .= " CLIENT_LOGIN_CHECK_TIMEOUT= " . $ loginCheckTimeout . "\n" ;
81- $ env .= " CLIENT_REFRESH_TOKEN_TIMEOUT= " . $ refreshTokenTimeout . "\n" ;
82- $ env .= " CLIENT_RELEASE_TIMESTAMP_INTERVAL_TIMEOUT= " . $ releaseTimestampIntervalTimeout . "\n" ;
83- $ env .= " CLIENT_SCHEDULING_INTERVAL= " . $ schedulingInterval . "\n" ;
84- $ env .= " CLIENT_PULL_STRATEGY_INTERVAL= " . $ pullStrategyInterval . "\n" ;
85- $ env .= " CLIENT_COLOR_SCHEME= " . $ colorSchemeValue . "\n" ;
86- $ env .= " CLIENT_DEBUG= " . $ debug . "\n" ;
80+ $ env .= ' CLIENT_LOGIN_CHECK_TIMEOUT= ' . $ loginCheckTimeout. "\n" ;
81+ $ env .= ' CLIENT_REFRESH_TOKEN_TIMEOUT= ' . $ refreshTokenTimeout. "\n" ;
82+ $ env .= ' CLIENT_RELEASE_TIMESTAMP_INTERVAL_TIMEOUT= ' . $ releaseTimestampIntervalTimeout. "\n" ;
83+ $ env .= ' CLIENT_SCHEDULING_INTERVAL= ' . $ schedulingInterval. "\n" ;
84+ $ env .= ' CLIENT_PULL_STRATEGY_INTERVAL= ' . $ pullStrategyInterval. "\n" ;
85+ $ env .= ' CLIENT_COLOR_SCHEME= ' . $ colorSchemeValue. "\n" ;
86+ $ env .= ' CLIENT_DEBUG= ' . $ debug. "\n" ;
8787 $ env .= "###< Client configuration ### \n" ;
8888
8989 $ output ->writeln ($ env );
0 commit comments