Skip to content

Commit

Permalink
refactor(commands): improve input handling in ScoreCommand
Browse files Browse the repository at this point in the history
- Refactored input handling in ScoreCommand
- Added loop to prompt for SQL statements until input is provided
  • Loading branch information
guanguans committed Jun 7, 2024
1 parent 4fb322e commit 08e6ef0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Commands/ScoreCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ class ScoreCommand extends Command
/**
* @noinspection ForgottenDebugOutputInspection
* @noinspection DebugFunctionUsageInspection
* @noinspection MethodShouldBeFinalInspection
*
* @throws \Guanguans\SoarPHP\Exceptions\InvalidOptionException
*/
public function handle(Soar $soar): void
{
collect($soar->arrayScores($this->ask(
'Please input the SQL statements'
)))->each(static fn (array $score) => dump($score));
for (;;) {
$sqls = $this->ask('Please input the SQL statements');
if ($sqls) {
break;
}
}

collect($soar->arrayScores($sqls))->each(static fn (array $score) => dump($score));
}
}

0 comments on commit 08e6ef0

Please sign in to comment.