Total Complexity | 4 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
11 | class PercentSpinner extends Spinner |
||
12 | { |
||
13 | protected const ERASING_SHIFT = 1; |
||
14 | protected const INTERVAL = 0.1; |
||
15 | protected const SYMBOLS = null; |
||
16 | protected const |
||
17 | STYLES = |
||
18 | [ |
||
19 | StylesInterface::SPINNER_STYLES => |
||
20 | [ |
||
21 | StylesInterface::COLOR256 => StylesInterface::DISABLED, |
||
22 | StylesInterface::COLOR => StylesInterface::DISABLED, |
||
23 | ], |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * @return Settings |
||
28 | */ |
||
29 | 3 | protected function defaultSettings(): Settings |
|
30 | { |
||
31 | return |
||
32 | 3 | parent::defaultSettings() |
|
33 | 3 | ->setPrefix(SettingsInterface::EMPTY); |
|
34 | } |
||
35 | |||
36 | 2 | public function spin(?float $percent = null): string |
|
37 | { |
||
38 | 2 | if (!\is_float($percent)) { |
|
39 | 1 | throw new \RuntimeException('Float percentage value expected ' . typeOf($percent) . ' given.'); |
|
40 | } |
||
41 | 1 | return parent::spin($percent); |
|
42 | } |
||
43 | |||
44 | 1 | public function begin(?float $percent = null): string |
|
47 | } |
||
48 | } |
||
49 |