@@ -23,45 +23,41 @@ class OAuth
2323 protected $ expireTimestamp ;
2424 protected $ accessToken ;
2525
26- protected $ cache ;
27- const CACHE_KEY = 'firebase-oauth ' ;
28-
2926 /**
3027 * OAuth constructor.
3128 *
3229 * @param $key
3330 * @param $iss
3431 * @param $lifeTime
3532 */
36- public function __construct ($ key , $ iss , $ lifeTime = 3600 , $ cache = false )
33+ public function __construct ($ key , $ iss , $ lifeTime = 3600 )
3734 {
3835 $ this ->key = $ key ;
3936 $ this ->iss = $ iss ;
4037 $ this ->tokenLifeTime = $ lifeTime ;
41- $ this ->cache = $ cache ;
4238 }
4339
44- public static function fromJson ($ jsonString , $ lifeTime = 3600 , $ cache = false )
40+ public static function fromJson ($ jsonString , $ lifeTime = 3600 )
4541 {
4642 if ($ jsonString ) {
4743 $ privateKey = $ jsonString ->private_key ;
4844 $ serviceAccount = $ jsonString ->client_email ;
4945
50- return new static ($ privateKey , $ serviceAccount , $ lifeTime, $ cache );
46+ return new static ($ privateKey , $ serviceAccount , $ lifeTime );
5147 } else {
5248 throw new \Exception ("can't get data from key file " );
5349 }
5450 }
5551
56- public static function fromKeyFile ($ keyFile , $ lifeTime = 3600 , $ cache = false )
52+ public static function fromKeyFile ($ keyFile , $ lifeTime = 3600 )
5753 {
5854 try {
5955 $ jsonString = json_decode (file_get_contents ($ keyFile ));
6056 } catch (\Exception $ exception ) {
61- $ jsonString = json_decode ( JCRequest::get ($ keyFile ));
57+ $ jsonString = JCRequest::get ($ keyFile )-> json ( );
6258 }
6359
64- return static ::fromJson ($ jsonString , $ lifeTime, $ cache );
60+ return static ::fromJson ($ jsonString , $ lifeTime );
6561 }
6662
6763 protected function requestAccessToken ()
0 commit comments