| Conditions | 2 |
| Paths | 2 |
| Total Lines | 25 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 3.3272 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 10 | 1 | public function __construct( |
|
| 11 | int $iterations = 1000, |
||
| 12 | bool $quiet = false |
||
| 13 | ) { |
||
| 14 | 1 | parent::__construct($iterations); |
|
| 15 | 1 | $width = $this->advanceSteps = $this->terminalWidth(); |
|
| 16 | 1 | if (!$quiet) { |
|
| 17 | $progressStart = |
||
| 18 | static function () use ($width): void { |
||
| 19 | echo ' [' . str_repeat('░', $width) . ']'; |
||
| 20 | echo "\e[" . ($width + 1) . 'D'; |
||
| 21 | }; |
||
| 22 | |||
| 23 | $progressAdvance = |
||
| 24 | static function (): void { |
||
| 25 | echo '█'; |
||
| 26 | }; |
||
| 27 | |||
| 28 | $progressFinish = |
||
| 29 | static function () use ($width): void { |
||
| 30 | echo "\e[" . ($width + 1) . 'D'; |
||
| 31 | echo "\e[K"; |
||
| 32 | }; |
||
| 33 | |||
| 34 | $this->showProgressBy($progressStart, $progressAdvance, $progressFinish); |
||
| 35 | } |
||
| 38 |