Passed
Push — master ( 18010c...ab4210 )
by Gabriel
02:26
created

Waredesk::getAccessToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Waredesk;
4
5
use GuzzleHttp\HandlerStack;
6
7
class Waredesk
8
{
9
    const PRODUCTION_API_URL = 'https://api.waredesk.com';
10
11
    /**
12
     * @var Products
13
     */
14
    public $products;
15
16
    private $apiUrl;
17
    private $requestHandler;
18
19 7
    public function __construct(string $clientId, string $clientSecret, string $accessToken = null)
20
    {
21 7
        $this->apiUrl = self::PRODUCTION_API_URL;
22 7
        $this->requestHandler = new RequestHandler($clientId, $clientSecret, $accessToken, $this->apiUrl);
23 7
        $this->products = new Products($this->requestHandler);
24 7
    }
25
26
    public function getApiUrl()
27
    {
28
        return $this->apiUrl;
29
    }
30
31 7
    public function setApiUrl($apiUrl)
32
    {
33 7
        $this->apiUrl = rtrim($apiUrl, '/');
34 7
        $this->requestHandler->setApiUrl($this->apiUrl);
35 7
    }
36
37
    public function getClientId(): string
38
    {
39
        return $this->requestHandler->getClientId();
40
    }
41
42 1
    public function setClientId(string $clientId = null)
43
    {
44 1
        $this->requestHandler->setClientId($clientId);
45 1
    }
46
47
    public function getClientSecret(): string
48
    {
49
        return $this->requestHandler->getClientSecret();
50
    }
51
52
    public function setClientSecret(string $clientSecret = null)
53
    {
54
        $this->requestHandler->setClientSecret($clientSecret);
55
    }
56
57 2
    public function getAccessToken(): string
58
    {
59 2
        return $this->requestHandler->getAccessToken();
60
    }
61
62 7
    public function setAccessToken(string $accessToken = null)
63
    {
64 7
        $this->requestHandler->setAccessToken($accessToken);
65 7
    }
66
67 7
    public function setMockHandler(HandlerStack $mockHandler = null)
68
    {
69 7
        $this->requestHandler->setMockHandler($mockHandler);
70 7
    }
71
}
72