Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commit033ec1b
committed
feature#35611 [Console] Moved estimated & remaining calculation logic 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 method1 file changed
+21
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
199 | 217 | | |
200 | 218 | | |
201 | 219 | | |
| |||
500 | 518 | | |
501 | 519 | | |
502 | 520 | | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
| 521 | + | |
510 | 522 | | |
511 | 523 | | |
512 | 524 | | |
513 | 525 | | |
514 | 526 | | |
515 | 527 | | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
| 528 | + | |
523 | 529 | | |
524 | 530 | | |
525 | 531 | | |
| |||
0 commit comments
Comments
(0)