File tree Expand file tree Collapse file tree 4 files changed +9
-66
lines changed
Expand file tree Collapse file tree 4 files changed +9
-66
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ parameters:
22 paths:
33 - src
44
5- level: max
5+ level: 8
66
77 reportUnmatchedIgnoredErrors: true
Original file line number Diff line number Diff line change @@ -24,9 +24,9 @@ class AutoRefreshOAuth2TokenPlugin implements Plugin
2424 protected RefreshToken $ refreshTokenGrant ;
2525
2626 /**
27- * @var Options
27+ * @var array<string, mixed>
2828 */
29- protected Options $ options ;
29+ protected array $ options ;
3030
3131 /**
3232 * @var array<string, mixed>
@@ -47,9 +47,13 @@ public function __construct(
4747 array $ options = [],
4848 array $ refreshTokenOptions = []
4949 ) {
50+ $ defaults = [
51+ 'threshold ' => 300 , // 5 minutes
52+ ];
53+
5054 $ this ->token = $ token ;
5155 $ this ->refreshTokenGrant = $ refreshTokenGrant ;
52- $ this ->options = new Options ( $ options );
56+ $ this ->options = array_replace_recursive ( $ defaults , $ options );
5357 $ this ->refreshTokenOptions = $ refreshTokenOptions ;
5458 }
5559
@@ -58,7 +62,7 @@ public function __construct(
5862 */
5963 protected function maybeRefreshToken (): void
6064 {
61- $ expires = $ this ->token ->getExpires () - $ this ->options -> threshold ;
65+ $ expires = $ this ->token ->getExpires () - ( int ) $ this ->options [ ' threshold ' ] ;
6266
6367 if (time () >= $ expires ) {
6468 $ this ->token = $ this ->refreshTokenGrant ->requestAccessToken (
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments