File tree 4 files changed +25
-7
lines changed
4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function restoreToken(TokenInterface $token)
27
27
return null ;
28
28
}
29
29
30
- $ data = json_decode (file_get_contents ($ this ->filepath ), true );
30
+ $ data = @ json_decode (file_get_contents ($ this ->filepath ), true );
31
31
32
32
if (false === $ data ) {
33
33
return null ;
@@ -39,7 +39,7 @@ public function restoreToken(TokenInterface $token)
39
39
public function deleteToken ()
40
40
{
41
41
if (file_exists ($ this ->filepath )) {
42
- unlink ($ this ->filepath );
42
+ @ unlink ($ this ->filepath );
43
43
}
44
44
}
45
45
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace kamermans \OAuth2 \Token ;
4
4
5
- class RawToken implements \ Serializable, TokenInterface
5
+ class RawToken implements Serializable, TokenInterface
6
6
{
7
7
// Pull in serialize() and unserialize() methods
8
8
use TokenSerializer;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace kamermans \OAuth2 \Token ;
4
+
5
+ interface Serializable
6
+ {
7
+ /**
8
+ * Serialize object.
9
+ *
10
+ * @return array
11
+ */
12
+ public function serialize ();
13
+ /**
14
+ * Unserialize object.
15
+ *
16
+ * @param array $data
17
+ */
18
+ public function unserialize (array $ data );
19
+ }
Original file line number Diff line number Diff line change @@ -31,11 +31,11 @@ trait TokenSerializer
31
31
*/
32
32
public function serialize ()
33
33
{
34
- return serialize ( [
34
+ return [
35
35
'access_token ' => $ this ->accessToken ,
36
36
'refresh_token ' => $ this ->refreshToken ,
37
37
'expires_at ' => $ this ->expiresAt ,
38
- ]) ;
38
+ ];
39
39
}
40
40
41
41
/**
@@ -44,8 +44,7 @@ public function serialize()
44
44
*/
45
45
public function unserialize ($ data )
46
46
{
47
- $ data = unserialize ($ data );
48
- if (!is_array ($ data ) || !isset ($ data ['access_token ' ])) {
47
+ if (!isset ($ data ['access_token ' ])) {
49
48
throw new \InvalidArgumentException ('Unable to create a RawToken without an "access_token" ' );
50
49
}
51
50
You can’t perform that action at this time.
0 commit comments