Passed
Push — master ( a772d5...a1c5a5 )
by Tharanga
06:09
created

CommonAccessToken::getRefreshToken()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
ccs 0
cts 0
cp 0
crap 2
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 11
     *
37
     * @param string $token the access token string
38 11
     * @param string $vendor name of the vendor. ex: Google
39 11
     * @param string|null $email [optional] associated email address to this token used within the vendor platform
40 11
     */
41 11
    public function __construct($token, $vendor, $email = null)
42
    {
43
        $this->token = $token;
44
        $this->vendor = $vendor;
45
        $this->email = $email;
46
    }
47
48 3
    /**
49
     * returns the access token string
50 3
     *
51
     * @return string
52
     */
53
    public function token()
54
    {
55
        return $this->token;
56
    }
57
58 3
    /**
59
     * returns name of the vendor. ex: Google
60 3
     *
61
     * @return string
62
     */
63
    public function vendor()
64
    {
65
        return $this->vendor;
66
    }
67
68 2
    /**
69
     * returns the associated email address to this token used within the vendor platform if any
70 2
     *
71
     * @return string
72
     */
73
    public function email()
74
    {
75
        return $this->email;
76
    }
77
78
    /**
79
     * returns the token used to refresh this access token
80
     *
81
     * @return string
82
     */
83
    public function getRefreshToken()
84
    {
85
        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
    public function setRefreshToken($refreshToken)
94
    {
95
        $this->refreshToken = $refreshToken;
96
    }
97
}
98