These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Godbout\Alfred\Time\Menus\Toggl; |
||
4 | |||
5 | use Godbout\Alfred\Workflow\Icon; |
||
6 | use Godbout\Alfred\Workflow\Item; |
||
7 | use Godbout\Alfred\Time\Menus\Menu; |
||
8 | use Godbout\Alfred\Workflow\ScriptFilter; |
||
9 | |||
10 | View Code Duplication | class SetupApikey extends Menu |
|
0 ignored issues
–
show
|
|||
11 | { |
||
12 | public static function scriptFilter() |
||
13 | { |
||
14 | ScriptFilter::add( |
||
15 | self::apikey(), |
||
16 | self::back() |
||
17 | ); |
||
18 | } |
||
19 | |||
20 | private static function apikey() |
||
21 | { |
||
22 | global $argv; |
||
23 | |||
24 | return Item::create() |
||
25 | ->title('Enter your API token above') |
||
26 | ->subtitle('Save ' . self::userInput()) |
||
27 | ->arg('toggl_setup_apikey_save') |
||
28 | ->variable('toggl_apikey', self::userInput()) |
||
29 | ->icon(Icon::create('resources/icons/toggl.png')); |
||
30 | } |
||
31 | |||
32 | private static function back() |
||
33 | { |
||
34 | return Item::create() |
||
35 | ->title('Back') |
||
36 | ->subtitle('Go back to Toggl options') |
||
37 | ->arg('toggl_setup') |
||
38 | ->icon(Icon::create('resources/icons/toggl.png')); |
||
39 | } |
||
40 | } |
||
41 |
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.