| 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 | 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() |
||
| 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) |
||
| 96 | } |
||
| 97 | } |
||
| 98 |