Total Complexity | 7 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 65.52% |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class ChooseTag extends Menu |
||
11 | { |
||
12 | 12 | public static function scriptFilter() |
|
13 | { |
||
14 | 12 | $service = Workflow::serviceEnabled(); |
|
15 | |||
16 | 12 | if ($service->allowsEmptyTag) { |
|
17 | 12 | ScriptFilter::add(self::getNoTag()); |
|
18 | } |
||
19 | |||
20 | 12 | foreach (self::getServiceTags($service) as $tag) { |
|
21 | ScriptFilter::add($tag); |
||
22 | } |
||
23 | |||
24 | 12 | if (self::userInput()) { |
|
25 | ScriptFilter::filterItems(self::userInput()); |
||
26 | } |
||
27 | |||
28 | 12 | ScriptFilter::sortItems('asc', 'match'); |
|
29 | 12 | } |
|
30 | |||
31 | 12 | private static function getNoTag() |
|
32 | { |
||
33 | 12 | return Item::create() |
|
34 | 12 | ->title('No tag') |
|
35 | 12 | ->subtitle('Timer will be created without a tag') |
|
36 | 12 | ->match('') |
|
37 | 12 | ->arg('do') |
|
38 | 12 | ->variable('action', 'start'); |
|
39 | } |
||
40 | |||
41 | 12 | private static function getServiceTags($service) |
|
57 | } |
||
58 | } |
||
59 |