Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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
fabpot left a comment
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?
peterjaap commentedFeb 7, 2020
@fabpot done! :) |
nicolas-grekas commentedFeb 7, 2020
The failure in tests is relevant to the change proposed here. |
peterjaap commentedFeb 7, 2020
@nicolas-grekas done 🎉 |
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedFeb 10, 2020
@peterjaap Can you rebase to get rid of the merge commit? Thank you. |
nicolas-grekas commentedFeb 10, 2020
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 methodUh 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 withsetPlaceholderFormatterDefinitionwithout having to redefine the calculation ourself.Example before;
Example after;