SetupApikey::apikey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 10
ccs 8
cts 8
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Godbout\Alfred\Time\Menus\Toggl;
4
5
use Godbout\Alfred\Time\Menus\Menu;
6
use Godbout\Alfred\Workflow\Icon;
7
use Godbout\Alfred\Workflow\Item;
8
use Godbout\Alfred\Workflow\ScriptFilter;
9
10
class SetupApikey extends Menu
11
{
12 6
    public static function scriptFilter()
13
    {
14 6
        ScriptFilter::add(
15 6
            self::apikey(),
16 6
            self::back()
17
        );
18 6
    }
19
20 6
    private static function apikey()
21
    {
22 6
        global $argv;
23
24 6
        return Item::create()
25 6
            ->title('Enter your API token above')
26 6
            ->subtitle('Save ' . self::userInput())
27 6
            ->arg('toggl_setup_apikey_save')
28 6
            ->variable('toggl_apikey', self::userInput())
29 6
            ->icon(Icon::create('resources/icons/toggl.png'));
30
    }
31
32 6
    private static function back()
33
    {
34 6
        return Item::create()
35 6
            ->title('Back')
36 6
            ->subtitle('Go back to Toggl options')
37 6
            ->arg('toggl_setup')
38 6
            ->icon(Icon::create('resources/icons/toggl.png'));
39
    }
40
}
41