1 | <?php |
||
12 | class ClientProvider |
||
13 | { |
||
14 | /** |
||
15 | * @var \Happyr\GoogleSiteAuthenticatorBundle\Model\TokenConfig config |
||
16 | */ |
||
17 | private $config; |
||
18 | |||
19 | /** |
||
20 | * @var CacheItemPoolInterface storage |
||
21 | */ |
||
22 | private $pool; |
||
23 | |||
24 | /** |
||
25 | * @param TokenConfig $config |
||
26 | * @param CacheItemPoolInterface $pool |
||
27 | */ |
||
28 | public function __construct(TokenConfig $config, CacheItemPoolInterface $pool) |
||
33 | |||
34 | /** |
||
35 | * @param string|null $tokenName |
||
36 | * |
||
37 | * @return \Google_Client |
||
38 | */ |
||
39 | public function getClient($tokenName = null) |
||
60 | |||
61 | /** |
||
62 | * Check if a token is valid. |
||
63 | * This is an expensive operation that makes multiple API calls. |
||
64 | * |
||
65 | * @param string|null $tokenName |
||
66 | * |
||
67 | * @return bool |
||
68 | */ |
||
69 | public function isTokenValid($tokenName = null) |
||
89 | |||
90 | /** |
||
91 | * Store the access token in the storage. |
||
92 | * |
||
93 | * @param string $accessToken |
||
94 | * @param string|null $tokenName |
||
95 | */ |
||
96 | public function setAccessToken($accessToken, $tokenName = null) |
||
110 | |||
111 | /** |
||
112 | * Get access token from storage. |
||
113 | * |
||
114 | * @param string|null $tokenName |
||
115 | * |
||
116 | * @return AccessToken|null |
||
117 | */ |
||
118 | protected function getAccessToken($tokenName = null) |
||
129 | |||
130 | /** |
||
131 | * If we got a refresh token, use it to retrieve a good access token. |
||
132 | * |
||
133 | * @param \Google_Client $client |
||
134 | */ |
||
135 | private function refreshToken(\Google_Client $client) |
||
151 | |||
152 | /** |
||
153 | * Create a cache key. |
||
154 | * |
||
155 | * @param string $name |
||
156 | * |
||
157 | * @return string |
||
158 | */ |
||
159 | private function creteCacheKey($name) |
||
163 | } |
||
164 |
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.