1 | <?php |
||
15 | class Access |
||
16 | { |
||
17 | /** |
||
18 | * @var string $token The access token itself |
||
19 | */ |
||
20 | protected $token; |
||
21 | |||
22 | /** |
||
23 | * @var string $tokenType The type of the token |
||
24 | */ |
||
25 | protected $tokenType; |
||
26 | |||
27 | /** |
||
28 | * @var int $expiresIn The time for the token to expire in seconds |
||
29 | */ |
||
30 | protected $expiresIn; |
||
31 | |||
32 | /** |
||
33 | * @var \DateTime $createdAt when was the token created |
||
34 | */ |
||
35 | protected $createdAt; |
||
36 | |||
37 | /** |
||
38 | * @var \DateTime $expiresAt when is the token expiring |
||
39 | */ |
||
40 | protected $expiresAt; |
||
41 | |||
42 | /** |
||
43 | * Access constructor. |
||
44 | * @param string $accessToken |
||
45 | * @param string $tokenType |
||
46 | * @param int $expiresIn |
||
47 | */ |
||
48 | public function __construct($accessToken, $tokenType, $expiresIn) |
||
57 | |||
58 | /** |
||
59 | * Create token from json object |
||
60 | * @param \stdClass $jsonObject |
||
61 | * @return \BlizzardApi\Tokens\Access |
||
62 | */ |
||
63 | public static function fromJson($jsonObject) |
||
67 | |||
68 | /** |
||
69 | * Check if the token is expired |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function isExpired() |
||
81 | |||
82 | /** |
||
83 | * Get the token string |
||
84 | * |
||
85 | * @return string |
||
86 | * @throws Expired |
||
87 | */ |
||
88 | public function getToken() |
||
96 | } |
||
97 |