Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat Proposal: add progressbar to output #78

Merged
4 changes: 3 additions & 1 deletion src/Output/ProgressBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ public function each($items, callable $callback = null)
$items = iterator_to_array($items);
}

$total = count($items);
if (0 === $total = count($items)) {
Copy link
Owner

@adhocore adhocore Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh oops, i think i didn't know how to format code suggestion of github.
the idea was to combine assignment and checks in oneliner

// before
$total = count($items) 
if (!$total) {
    return;
}

// after
if (0 === $total = count($items)) {
    return;
}

return;
}
if (!$total) {
return;
}
Expand Down