These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | $valid = true; |
||
4 | $userQueryCommandFound = false; |
||
5 | |||
6 | switch ($query) { |
||
7 | View Code Duplication | case 'config': |
|
0 ignored issues
–
show
|
|||
8 | $userQueryCommandFound = true; |
||
9 | $data['action'] = 'edit'; |
||
10 | $title = 'Edit config file'; |
||
11 | $subtitle = 'Open the config file in your favorite editor!'; |
||
12 | break; |
||
13 | |||
14 | View Code Duplication | case 'sync': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
15 | $userQueryCommandFound = true; |
||
16 | $data['action'] = 'sync'; |
||
17 | $title = 'Sync projects and tags from online to local cache'; |
||
18 | $subtitle = 'Update local projects and tags data'; |
||
19 | break; |
||
20 | |||
21 | View Code Duplication | case 'delete': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
22 | $userQueryCommandFound = true; |
||
23 | $data['action'] = 'delete'; |
||
24 | $title = 'Delete a timer'; |
||
25 | $subtitle = 'Press enter to load recent timers list'; |
||
26 | break; |
||
27 | |||
28 | case 'undo': |
||
29 | $userQueryCommandFound = true; |
||
30 | $data['action'] = 'undo'; |
||
31 | |||
32 | $runningServices = $config->runningServices(); |
||
33 | |||
34 | if (empty($runningServices) === true) { |
||
35 | $title = 'Undo ""'; |
||
36 | $subtitle = 'Nothing to undo!'; |
||
37 | $valid = false; |
||
38 | } else { |
||
39 | $title = 'Undo "' . $timer->getDescription() . '"'; |
||
40 | $subtitle = $timer->isRunning() === true ? 'Stop and delete current timer for ' : 'Delete timer for '; |
||
41 | $subtitle .= implode(' and ', array_map('ucfirst', $runningServices)); |
||
42 | } |
||
43 | |||
44 | break; |
||
45 | } |
||
46 | |||
47 | if ($userQueryCommandFound === true) { |
||
48 | $workflow->result() |
||
49 | ->uid('') |
||
50 | ->arg(json_encode($data)) |
||
51 | ->title($title) |
||
52 | ->subtitle($subtitle) |
||
53 | ->type('default') |
||
54 | ->valid($valid); |
||
55 | |||
56 | echo $workflow->output(); |
||
57 | exit(); |
||
58 | } |
||
59 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.