TrelloClient   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 7
c 2
b 0
f 2
lcom 1
cbo 1
dl 0
loc 77
ccs 21
cts 21
cp 1
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A setApiKey() 0 4 1
A setApiToken() 0 4 1
A getApiKey() 0 4 1
A getApiToken() 0 4 1
A setClient() 0 5 1
A getClient() 0 4 1
1
<?php
2
3
namespace TrelloBurndown\Client;
4
5
use Trello\Client;
6
7
/**
8
 * Class TrelloClient.
9
 */
10
class TrelloClient
11
{
12
    /**
13
     * @var string
14
     */
15
    private $apiKey;
16
    /**
17
     * @var string
18
     */
19
    private $apiToken;
20
    /**
21
     * @var Client
22
     */
23
    protected $client;
24
25
    /**
26
     * TrelloManager constructor.
27
     *
28
     * @param string $apiKey
29
     * @param string $apiToken
30
     */
31 2
    public function __construct(String $apiKey, String $apiToken)
32
    {
33 2
        $this->apiKey = $apiKey;
34 2
        $this->apiToken = $apiToken;
35 2
        $this->setClient();
36 2
    }
37
38
    /**
39
     * @param string $apiKey
40
     */
41 1
    public function setApiKey(String $apiKey)
42
    {
43 1
        $this->apiKey = $apiKey;
44 1
    }
45
46
    /**
47
     * @param string $apiToken
48
     */
49 1
    public function setApiToken(String $apiToken)
50
    {
51 1
        $this->apiToken = $apiToken;
52 1
    }
53
54
    /**
55
     * @return string
56
     */
57 1
    public function getApiKey()
58
    {
59 1
        return $this->apiKey;
60
    }
61
62
    /**
63
     * @return string
64
     */
65 1
    public function getApiToken()
66
    {
67 1
        return $this->apiToken;
68
    }
69
70
    /**
71
     * Set Client and authenticate.
72
     */
73 2
    public function setClient()
74
    {
75 2
        $this->client = new Client();
76 2
        $this->client->authenticate($this->apiKey, $this->apiToken, Client::AUTH_URL_CLIENT_ID);
77 2
    }
78
79
    /**
80
     * @return Client
81
     */
82 1
    public function getClient()
83
    {
84 1
        return $this->client;
85
    }
86
}
87