Total Complexity | 4 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | class SleepTask extends AbstractTask |
||
24 | { |
||
25 | 48 | public function getName(): string |
|
26 | { |
||
27 | 48 | return 'sleep'; |
|
28 | } |
||
29 | |||
30 | 2 | public function getDescription(): string |
|
31 | { |
||
32 | 2 | $options = $this->getOptions(); |
|
33 | |||
34 | 2 | return sprintf('[Sleep] Sleeping for %d second(s)', $options['seconds']); |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * @throws ErrorException |
||
39 | */ |
||
40 | 2 | public function execute(): bool |
|
41 | { |
||
42 | 2 | $options = $this->getOptions(); |
|
43 | |||
44 | 2 | sleep(intval($options['seconds'])); |
|
45 | |||
46 | 2 | return true; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * @return array<string, string|int> |
||
51 | */ |
||
52 | 2 | protected function getOptions(): array |
|
60 | } |
||
61 | } |
||
62 |