Conditions | 2 |
Paths | 2 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | protected function getClient() |
||
23 | { |
||
24 | $token = Analytics::$plugin->getOauth()->getToken(); |
||
25 | |||
26 | if ($token) { |
||
27 | // make token compatible with Google Client |
||
28 | |||
29 | $arrayToken = json_encode([ |
||
30 | 'created' => 0, |
||
31 | 'access_token' => $token->getToken(), |
||
32 | 'expires_in' => $token->getExpires(), |
||
33 | ]); |
||
34 | |||
35 | // client |
||
36 | $client = new Google_Client(); |
||
37 | $client->setApplicationName('Google+ PHP Starter Application'); |
||
38 | $client->setClientId('clientId'); |
||
39 | $client->setClientSecret('clientSecret'); |
||
40 | $client->setRedirectUri('redirectUri'); |
||
41 | $client->setAccessToken($arrayToken); |
||
42 | |||
43 | return $client; |
||
44 | } |
||
45 | |||
46 | return null; |
||
47 | } |
||
49 |