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