@@ -236,33 +236,32 @@ private function check_dependencies(array $dependencies): bool
236236 return true ;
237237 }
238238
239+ private const GITHUB_ACTIONS_TYPES = [
240+ 0 => ['githubactions ' => false , 'githubactions_custom ' => false ], // No
241+ 1 => ['githubactions ' => true , 'githubactions_custom ' => false ], // Reusable
242+ 2 => ['githubactions ' => false , 'githubactions_custom ' => true ], // Standalone
243+ ];
244+
239245 /**
240246 * Handle GitHub Actions specific logic
241247 */
242248 private function handle_github_actions (): void
243249 {
244- $ question = $ this ->language ->lang ('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS ' ) . $ this ->language ->lang ('COLON ' );
245- $ choices = [
246- $ this ->language ->lang ('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CLI ' , 0 ),
247- $ this ->language ->lang ('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CLI ' , 1 ),
248- $ this ->language ->lang ('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CLI ' , 2 ),
249- ];
250-
251- $ question = new ChoiceQuestion ($ question , $ choices , 0 );
250+ $ questionText = $ this ->language ->lang ('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS ' ) . $ this ->language ->lang ('COLON ' );
251+ $ choices = [];
252+ foreach (array_keys (self ::GITHUB_ACTIONS_TYPES ) as $ i )
253+ {
254+ $ choices [] = $ this ->language ->lang ('SKELETON_QUESTION_COMPONENT_GITHUBACTIONS_CLI ' , $ i );
255+ }
252256
257+ $ question = new ChoiceQuestion ($ questionText , $ choices , 0 );
253258 $ choice = $ this ->helper ->ask ($ this ->input , $ this ->output , $ question );
254259 $ index = array_search ($ choice , $ choices , true );
255260
256- $ this ->data ['components ' ]['githubactions ' ] = false ;
257- $ this ->data ['components ' ]['githubactions_custom ' ] = false ;
258-
259- if ($ index === 1 )
260- {
261- $ this ->data ['components ' ]['githubactions ' ] = true ;
262- }
263- else if ($ index === 2 )
264- {
265- $ this ->data ['components ' ]['githubactions_custom ' ] = true ;
266- }
261+ $ componentSettings = self ::GITHUB_ACTIONS_TYPES [$ index ] ?? self ::GITHUB_ACTIONS_TYPES [0 ];
262+ $ this ->data ['components ' ] = array_merge (
263+ $ this ->data ['components ' ] ?? [],
264+ $ componentSettings
265+ );
267266 }
268267}
0 commit comments