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

Clockify   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Test Coverage

Coverage 53.85%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 20
c 1
b 0
f 1
dl 0
loc 65
ccs 14
cts 26
cp 0.5385
rs 10
wmc 12

10 Methods

Rating   Name   Duplication   Size   Complexity  
A deleteTimer() 0 3 1
A __construct() 0 3 1
A projects() 0 8 2
A stopCurrentTimer() 0 3 1
A tags() 0 3 1
A pastTimers() 0 3 1
A startTimer() 0 3 1
A continueTimer() 0 3 1
A runningTimer() 0 3 1
A workspaces() 0 6 2
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