@@ -61,6 +61,11 @@ abstract class AbstractAccessToken
6161 */
6262 protected $ http ;
6363
64+ /**
65+ * @var Foundation
66+ */
67+ protected $ app ;
68+
6469 /**
6570 * Token string.
6671 *
@@ -69,8 +74,17 @@ abstract class AbstractAccessToken
6974 protected $ token ;
7075
7176 /**
72- * @param mixed $token
73- * @param int $expires
77+ * AbstractAccessToken constructor.
78+ * @param Foundation $app
79+ */
80+ public function __construct (Foundation $ app )
81+ {
82+ $ this ->app = $ app ;
83+ }
84+
85+ /**
86+ * @param mixed $token
87+ * @param int $expires
7488 * @return $this
7589 */
7690 public function setToken ($ token , $ expires = 86400 )
@@ -87,7 +101,7 @@ public function setToken($token, $expires = 86400)
87101 /**
88102 * Get token from cache.
89103 *
90- * @param bool $forceRefresh
104+ * @param bool $forceRefresh
91105 *
92106 * @return string
93107 */
@@ -128,7 +142,7 @@ abstract public function getTokenFromServer();
128142 abstract public function checkTokenResponse ($ result );
129143
130144 /**
131- * @param mixed $appId
145+ * @param mixed $appId
132146 */
133147 public function setAppId ($ appId )
134148 {
@@ -144,7 +158,7 @@ public function getAppId()
144158 }
145159
146160 /**
147- * @param string $secret
161+ * @param string $secret
148162 */
149163 public function setSecret ($ secret )
150164 {
@@ -162,7 +176,7 @@ public function getSecret()
162176 /**
163177 * Set cache instance.
164178 *
165- * @param \Doctrine\Common\Cache\Cache $cache
179+ * @param \Doctrine\Common\Cache\Cache $cache
166180 *
167181 * @return AbstractAccessToken
168182 */
@@ -204,13 +218,13 @@ public function getCacheKey()
204218 */
205219 public function getHttp ()
206220 {
207- return $ this ->http ?: $ this ->http = new Http () ;
221+ return $ this ->http ?? $ this ->app -> http ;
208222 }
209223
210224 /**
211225 * Set the http instance.
212226 *
213- * @param Http $http
227+ * @param Http $http
214228 *
215229 * @return $this
216230 */
0 commit comments