Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| ProgressTracker | |
0.00% |
0 / 7 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| set | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| getProgress | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getStep | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Modules\Updater\Services; |
| 4 | |
| 5 | class ProgressTracker |
| 6 | { |
| 7 | public function __construct(protected UpdateState $state) {} |
| 8 | |
| 9 | public function set(int $progress, string $step): void |
| 10 | { |
| 11 | $this->state->update([ |
| 12 | 'progress' => $progress, |
| 13 | 'step' => $step |
| 14 | ]); |
| 15 | } |
| 16 | |
| 17 | public function getProgress(): int |
| 18 | { |
| 19 | return (int) $this->state->get()['progress']; |
| 20 | } |
| 21 | |
| 22 | public function getStep(): string |
| 23 | { |
| 24 | return $this->state->get()['step']; |
| 25 | } |
| 26 | } |