| 1 | <?php |
||
| 7 | class AccessToken |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | public $accessToken; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | public $refreshToken; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | public $expiresIn; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Token constructor. |
||
| 26 | * |
||
| 27 | * @param string $accessToken |
||
| 28 | * @param string $refreshToken |
||
| 29 | * @param int $expiresIn |
||
| 30 | */ |
||
| 31 | 6 | public function __construct(string $accessToken = '', string $refreshToken = '', int $expiresIn = 0) |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @param \League\OAuth2\Client\Token\AccessToken $token |
||
| 40 | * |
||
| 41 | * @return \TestMonitor\DevOps\AccessToken |
||
| 42 | */ |
||
| 43 | 2 | public static function fromDevOps(VSTSAccessToken $token) |
|
| 51 | |||
| 52 | /** |
||
| 53 | * Determines if the access token has expired. |
||
| 54 | * |
||
| 55 | * @return bool |
||
| 56 | */ |
||
| 57 | 5 | public function expired() |
|
| 61 | |||
| 62 | /** |
||
| 63 | * Returns the token as an array. |
||
| 64 | * |
||
| 65 | * @return array |
||
| 66 | */ |
||
| 67 | 1 | public function toArray() |
|
| 75 | } |
||
| 76 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.