CommonAccessToken   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 84
ccs 15
cts 15
cp 1
rs 10
c 1
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getRefreshToken() 0 3 1
A token() 0 3 1
A vendor() 0 3 1
A setRefreshToken() 0 3 1
A __construct() 0 5 1
A email() 0 3 1
1
<?php
2
/**
3
 * @author Tharanga Kothalawala <[email protected]>
4
 * @date 30-12-2018
5
 */
6
7
namespace TSK\SSO\ThirdParty;
8
9
/**
10
 * @package TSK\SSO\ThirdParty
11
 */
12
class CommonAccessToken
13
{
14
    /**
15
     * @var string the access token string
16
     */
17
    private $token;
18
19
    /**
20
     * @var string name of the vendor. ex: Google
21
     */
22
    private $vendor;
23
24
    /**
25
     * @var string email used within the vendor platform
26
     */
27
    private $email;
28
29
    /**
30
     * @var string token used to refresh this access token
31
     */
32
    private $refreshToken;
33
34
    /**
35
     * This value object can be used to represent an access token by any third party vendor.
36
     *
37
     * @param string $token the access token string
38
     * @param string $vendor name of the vendor. ex: Google
39
     * @param string|null $email [optional] associated email address to this token used within the vendor platform
40
     */
41 11
    public function __construct($token, $vendor, $email = null)
42
    {
43 11
        $this->token = $token;
44 11
        $this->vendor = $vendor;
45 11
        $this->email = $email;
46 11
    }
47
48
    /**
49
     * returns the access token string
50
     *
51
     * @return string
52
     */
53 3
    public function token()
54
    {
55 3
        return $this->token;
56
    }
57
58
    /**
59
     * returns name of the vendor. ex: Google
60
     *
61
     * @return string
62
     */
63 3
    public function vendor()
64
    {
65 3
        return $this->vendor;
66
    }
67
68
    /**
69
     * returns the associated email address to this token used within the vendor platform if any
70
     *
71
     * @return string
72
     */
73 2
    public function email()
74
    {
75 2
        return $this->email;
76
    }
77
78
    /**
79
     * returns the token used to refresh this access token
80
     *
81
     * @return string
82
     */
83 2
    public function getRefreshToken()
84
    {
85 2
        return $this->refreshToken;
86
    }
87
88
    /**
89
     * Set the token used to refresh this access token
90
     *
91
     * @param string $refreshToken refresh token
92
     */
93 1
    public function setRefreshToken($refreshToken)
94
    {
95 1
        $this->refreshToken = $refreshToken;
96 1
    }
97
}
98