Total Complexity | 6 |
Total Lines | 84 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
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() |
|
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) |
|
96 | 1 | } |
|
97 | } |
||
98 |