Passed
Push — clockify ( 42cad4...653eb0 )
by Guillaume
19:35
created

Clockify::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Godbout\Alfred\Time\Services;
4
5
use JDecool\Clockify\ClientBuilder;
6
7
class Clockify extends TimerService
8
{
9
    private $client;
10
11
    private $data = null;
0 ignored issues
show
introduced by
The private property $data is not used, and could be removed.
Loading history...
12
13
14 22
    public function __construct($apiToken)
15
    {
16 22
        $this->client = (new ClientBuilder())->createClientV1($apiToken);
17 22
    }
18
19 11
    public function workspaces()
20
    {
21
        try {
22 11
            return $this->client->get('workspaces');
23 11
        } catch (\Exception $e) {
24 11
            return [];
25
        }
26
    }
27
28 11
    public function projects()
29
    {
30
        try {
31 11
            $workspaceId = getenv('timer_workspace_id');
32
33 11
            return $this->client->get("workspaces/$workspaceId/projects");
34 11
        } catch (\Exception $e) {
35 11
            return [];
36
        }
37
    }
38
39
    public function tags()
40
    {
41
        return [];
42
    }
43
44
    public function pastTimers()
45
    {
46
        return [];
47
    }
48
49
    public function startTimer()
50
    {
51
        return false;
52
    }
53
54
    public function stopCurrentTimer()
55
    {
56
        return false;
57
    }
58
59 22
    public function runningTimer()
60
    {
61 22
        return false;
62
    }
63
64
    public function continueTimer($timerId = null)
65
    {
66
        return false;
67
    }
68
69
    public function deleteTimer($timerId)
70
    {
71
        return false;
72
    }
73
}
74