21
21
*
22
22
* @package LinkedIn
23
23
*/
24
- class AccessToken
24
+ class AccessToken implements \JsonSerializable
25
25
{
26
26
27
27
/**
@@ -80,7 +80,7 @@ public function setToken($token)
80
80
}
81
81
82
82
/**
83
- * Get token expiration
83
+ * The number of seconds remaining, from the time it was requested, before the token will expire.
84
84
*
85
85
* @return int seconds
86
86
*/
@@ -92,7 +92,7 @@ public function getExpiresIn()
92
92
/**
93
93
* Set token expiration time
94
94
*
95
- * @param int $expiresIn seconds
95
+ * @param int $expiresIn amount of seconds before expiration
96
96
*
97
97
* @return AccessToken
98
98
*/
@@ -113,6 +113,8 @@ public function __toString()
113
113
}
114
114
115
115
/**
116
+ * Get Unix epoch time when token will expire
117
+ *
116
118
* @return int
117
119
*/
118
120
public function getExpiresAt ()
@@ -121,7 +123,9 @@ public function getExpiresAt()
121
123
}
122
124
123
125
/**
124
- * @param int $expiresAt
126
+ * Set Unix epoch time when token will expire
127
+ *
128
+ * @param int $expiresAt seconds, unix time
125
129
*
126
130
* @return AccessToken
127
131
*/
@@ -132,7 +136,7 @@ public function setExpiresAt($expiresAt)
132
136
}
133
137
134
138
/**
135
- * Instantiate token object
139
+ * Instantiate access token object
136
140
*
137
141
* @param $responseArray
138
142
*
@@ -160,4 +164,14 @@ public static function fromResponseArray($responseArray)
160
164
$ responseArray ['expires_in ' ] + time ()
161
165
);
162
166
}
167
+
168
+ public function jsonSerialize ()
169
+ {
170
+ return [
171
+ 'token ' => $ this ->getToken (),
172
+ 'expiresAt ' => $ this ->getExpiresAt (),
173
+ ];
174
+ }
175
+
176
+
163
177
}
0 commit comments