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