Skip to content

Commit

Permalink
UtilsRandomCommand: count move to own property
Browse files Browse the repository at this point in the history
  • Loading branch information
h4kuna authored and f3l1x committed Sep 1, 2021
1 parent 4782f60 commit afdcee8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Command/Utils/UtilsRandomCommand.php
Expand Up @@ -32,16 +32,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$table = new Table($output);
$table->setHeaders(['ID', 'Generated strings']);

for ($i = 1; $i <= $input->getOption('count'); $i++) {
$count = min((int) $input->getOption('count'), 1);
for ($i = 1; $i <= $count; $i++) {
$table->addRow([$i, Random::generate(50)]);

if ($i !== intval($input->getOption('count'))) {
if ($i !== $count) {
$table->addRow(new TableSeparator());
}
}

$table->render();
$style->success(sprintf('Total generated strings %d.', intval($input->getOption('count'))));
$style->success(sprintf('Total generated strings %d.', $count));

return 0;
}
Expand Down

0 comments on commit afdcee8

Please sign in to comment.