Total Complexity | 10 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Coverage | 97.37% |
Changes | 0 |
1 | <?php |
||
11 | class Entrance extends Menu |
||
12 | { |
||
13 | 7 | public static function scriptFilter() |
|
18 | ); |
||
19 | 7 | } |
|
20 | |||
21 | 7 | private static function timerAction() |
|
22 | { |
||
23 | 7 | $serviceEnabled = Workflow::serviceEnabled(); |
|
24 | |||
25 | 7 | if (! $serviceEnabled) { |
|
26 | 3 | return; |
|
27 | } |
||
28 | |||
29 | 4 | if ($serviceEnabled->runningTimer()) { |
|
30 | 1 | return self::stopCurrentTimer(); |
|
31 | } |
||
32 | |||
33 | 3 | return self::startTimer(); |
|
34 | } |
||
35 | |||
36 | 1 | private static function stopCurrentTimer() |
|
37 | { |
||
38 | 1 | return Item::create() |
|
39 | 1 | ->uid('stop_timer') |
|
40 | 1 | ->title('Stop current timer') |
|
41 | 1 | ->subtitle('That timer is currently running!') |
|
42 | 1 | ->arg('do') |
|
43 | 1 | ->variable('timer_action', 'stop'); |
|
44 | } |
||
45 | |||
46 | 3 | private static function startTimer() |
|
47 | { |
||
48 | 3 | if (! empty(Workflow::serviceEnabled())) { |
|
49 | 3 | return Item::create() |
|
50 | 3 | ->uid('start_timer') |
|
51 | 3 | ->title('Start "' . self::userInput() . '"') |
|
52 | 3 | ->mod( |
|
53 | 3 | Cmd::create() |
|
54 | 3 | ->subtitle('Continue a timer') |
|
55 | 3 | ->arg('choose_timer') |
|
56 | ) |
||
57 | 3 | ->arg('choose_project') |
|
58 | 3 | ->variable('timer_description', self::userInput()); |
|
59 | } |
||
60 | } |
||
61 | |||
62 | 7 | private static function setupWorkflow() |
|
70 | } |
||
71 | 1 | } |
|
72 | } |
||
73 |