Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Console] Moved estimated & remaining calculation logic to separate get method#35611
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you apply fabbot's patch?
@fabpot done! :) |
The failure in tests is relevant to the change proposed here. |
@nicolas-grekas done 🎉 |
Uh oh!
There was an error while loading.Please reload this page.
@peterjaap Can you rebase to get rid of the merge commit? Thank you. |
Thank you@peterjaap. |
…c to separate get method (peterjaap)This PR was squashed before being merged into the 5.1-dev branch.Discussion----------[Console] Moved estimated & remaining calculation logic to separate get method| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| Deprecations? | no| Tickets | -| License | MITThis way, we can use `getEstimated()`and `getRemaining()` to get easy access to the estimated / remaining number of seconds to be used in our placeholder definition set with `setPlaceholderFormatterDefinition` without having to redefine the calculation ourself.Example before;```phpProgressBar::setPlaceholderFormatterDefinition( 'eta', function (ProgressBar $progressBar) { $estimated = round((time() - $progressBar->getStartTime()) / ($progressBar->getProgress() ?: 0.1) * $progressBar->getMaxSteps()); return date('H:i:s', strtotime('+' . $estimated . ' seconds')); });```Example after;```phpProgressBar::setPlaceholderFormatterDefinition( 'eta', function (ProgressBar $progressBar) { return date('H:i:s', strtotime('+' . $this->getEstimated() . ' seconds')); });```Commits-------19958fb [Console] Moved estimated & remaining calculation logic to separate get method
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
This way, we can use
getEstimated()
andgetRemaining()
to get easy access to the estimated / remaining number of seconds to be used in our placeholder definition set withsetPlaceholderFormatterDefinition
without having to redefine the calculation ourself.Example before;
Example after;