Completed
Push — master ( e6ba08...9dbf89 )
by Gabriel
02:34
created

Waredesk::getApiUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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