Skip to content

Commit 9197ec8

Browse files
author
Md. Alimuzzaman Alim
committed
Merge branch 'google-sdk-conflict' into develop-alim
2 parents 3fab05b + 84fdee0 commit 9197ec8

File tree

70 files changed

+239
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+239
-145
lines changed

lib/Google/composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@
2525
"cache/filesystem-adapter": "For caching certs and tokens (using Google_Client::setCache)"
2626
},
2727
"autoload": {
28-
"psr-0": {
29-
"Google_": "src/"
30-
},
3128
"classmap": [
32-
"src/Google/Service/"
29+
"src/Google/"
3330
]
3431
},
3532
"extra": {

lib/Google/src/Google/AccessToken/Revoke.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18+
namespace wpCloud\StatelessMedia\Google_Client;
1819

1920
use Google\Auth\HttpHandler\HttpHandlerFactory;
2021
use GuzzleHttp\ClientInterface;

lib/Google/src/Google/AccessToken/Verify.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18+
namespace wpCloud\StatelessMedia\Google_Client;
1819

1920
use Firebase\JWT\ExpiredException as ExpiredExceptionV3;
2021
use Firebase\JWT\SignatureInvalidException;
@@ -79,7 +80,7 @@ public function __construct(
7980
public function verifyIdToken($idToken, $audience = null)
8081
{
8182
if (empty($idToken)) {
82-
throw new LogicException('id_token cannot be null');
83+
throw new \LogicException('id_token cannot be null');
8384
}
8485

8586
// set phpseclib constants if applicable
@@ -123,7 +124,7 @@ public function verifyIdToken($idToken, $audience = null)
123124
return false;
124125
} catch (SignatureInvalidException $e) {
125126
// continue
126-
} catch (DomainException $e) {
127+
} catch (\DomainException $e) {
127128
// continue
128129
}
129130
}
@@ -196,7 +197,7 @@ private function getFederatedSignOnCerts()
196197
}
197198

198199
if (!isset($certs['keys'])) {
199-
throw new InvalidArgumentException(
200+
throw new \InvalidArgumentException(
200201
'federated sign-on certs expects "keys" to be set'
201202
);
202203
}

lib/Google/src/Google/AuthHandler/AuthHandlerFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
namespace wpCloud\StatelessMedia\Google_Client;
1718

1819
use GuzzleHttp\Client;
1920
use GuzzleHttp\ClientInterface;
@@ -36,7 +37,7 @@ public static function build($cache = null, array $cacheConfig = [])
3637
case '6':
3738
return new Google_AuthHandler_Guzzle6AuthHandler($cache, $cacheConfig);
3839
default:
39-
throw new Exception('Version not supported');
40+
throw new \Exception('Version not supported');
4041
}
4142
}
4243
}

lib/Google/src/Google/AuthHandler/Guzzle5AuthHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace wpCloud\StatelessMedia\Google_Client;
23

34
use Google\Auth\CredentialsLoader;
45
use Google\Auth\HttpHandler\HttpHandlerFactory;

lib/Google/src/Google/AuthHandler/Guzzle6AuthHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace wpCloud\StatelessMedia\Google_Client;
23

34
use Google\Auth\CredentialsLoader;
45
use Google\Auth\HttpHandler\HttpHandlerFactory;

lib/Google/src/Google/Client.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
namespace wpCloud\StatelessMedia\Google_Client;
1718

1819
use Google\Auth\ApplicationDefaultCredentials;
1920
use Google\Auth\Cache\MemoryCacheItemPool;
@@ -179,7 +180,7 @@ public function authenticate($code)
179180
public function fetchAccessTokenWithAuthCode($code)
180181
{
181182
if (strlen($code) == 0) {
182-
throw new InvalidArgumentException("Invalid code");
183+
throw new \InvalidArgumentException("Invalid code");
183184
}
184185

185186
$auth = $this->getOAuth2Service();
@@ -216,7 +217,7 @@ public function refreshTokenWithAssertion()
216217
public function fetchAccessTokenWithAssertion(ClientInterface $authHttp = null)
217218
{
218219
if (!$this->isUsingApplicationDefaultCredentials()) {
219-
throw new DomainException(
220+
throw new \DomainException(
220221
'set the JSON service account credentials using'
221222
. ' Google_Client::setAuthConfig or set the path to your JSON file'
222223
. ' with the "GOOGLE_APPLICATION_CREDENTIALS" environment variable'
@@ -263,7 +264,7 @@ public function fetchAccessTokenWithRefreshToken($refreshToken = null)
263264
{
264265
if (null === $refreshToken) {
265266
if (!isset($this->token['refresh_token'])) {
266-
throw new LogicException(
267+
throw new \LogicException(
267268
'refresh token must be passed in or set as part of setAccessToken'
268269
);
269270
}
@@ -412,7 +413,7 @@ public function isUsingApplicationDefaultCredentials()
412413

413414
/**
414415
* @param string|array $token
415-
* @throws InvalidArgumentException
416+
* @throws \InvalidArgumentException
416417
*/
417418
public function setAccessToken($token)
418419
{
@@ -427,10 +428,10 @@ public function setAccessToken($token)
427428
}
428429
}
429430
if ($token == null) {
430-
throw new InvalidArgumentException('invalid json token');
431+
throw new \InvalidArgumentException('invalid json token');
431432
}
432433
if (!isset($token['access_token'])) {
433-
throw new InvalidArgumentException("Invalid token format");
434+
throw new \InvalidArgumentException("Invalid token format");
434435
}
435436
$this->token = $token;
436437
}
@@ -489,7 +490,7 @@ public function isAccessTokenExpired()
489490
*/
490491
public function getAuth()
491492
{
492-
throw new BadMethodCallException(
493+
throw new \BadMethodCallException(
493494
'This function no longer exists. See UPGRADING.md for more information'
494495
);
495496
}
@@ -499,7 +500,7 @@ public function getAuth()
499500
*/
500501
public function setAuth($auth)
501502
{
502-
throw new BadMethodCallException(
503+
throw new \BadMethodCallException(
503504
'This function no longer exists. See UPGRADING.md for more information'
504505
);
505506
}
@@ -693,7 +694,7 @@ public function revokeToken($token = null)
693694
* Verify an id_token. This method will verify the current id_token, if one
694695
* isn't provided.
695696
*
696-
* @throws LogicException
697+
* @throws \LogicException
697698
* @param string|null $idToken The token (id_token) that should be verified.
698699
* @return array|false Returns the token payload as an array if the verification was
699700
* successful, false otherwise.
@@ -709,7 +710,7 @@ public function verifyIdToken($idToken = null)
709710
if (null === $idToken) {
710711
$token = $this->getAccessToken();
711712
if (!isset($token['id_token'])) {
712-
throw new LogicException(
713+
throw new \LogicException(
713714
'id_token must be passed in or set as part of setAccessToken'
714715
);
715716
}
@@ -856,13 +857,13 @@ public function setAuthConfig($config)
856857
{
857858
if (is_string($config)) {
858859
if (!file_exists($config)) {
859-
throw new InvalidArgumentException('file does not exist');
860+
throw new \InvalidArgumentException('file does not exist');
860861
}
861862

862863
$json = file_get_contents($config);
863864

864865
if (!$config = json_decode($json, true)) {
865-
throw new LogicException('invalid json for auth config');
866+
throw new \LogicException('invalid json for auth config');
866867
}
867868
}
868869

@@ -1091,7 +1092,7 @@ private function createApplicationDefaultCredentials()
10911092
// @see https://developers.google.com/identity/protocols/OAuth2ServiceAccount
10921093
if ($sub) {
10931094
if (!$credentials instanceof ServiceAccountCredentials) {
1094-
throw new DomainException('domain-wide authority requires service account credentials');
1095+
throw new \DomainException('domain-wide authority requires service account credentials');
10951096
}
10961097

10971098
$credentials->setSub($sub);

lib/Google/src/Google/Collection.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<?php
2-
3-
if (!class_exists('Google_Client')) {
4-
require_once __DIR__ . '/autoload.php';
5-
}
2+
namespace wpCloud\StatelessMedia\Google_Client;
63

74
/**
85
* Extension to the regular Google_Model that automatically
96
* exposes the items array for iteration, so you can just
107
* iterate over the object rather than a reference inside.
118
*/
12-
class Google_Collection extends Google_Model implements Iterator, Countable
9+
class Google_Collection extends Google_Model implements \Iterator, \Countable
1310
{
1411
protected $collection_key = 'items';
1512

lib/Google/src/Google/Exception.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
namespace wpCloud\StatelessMedia\Google_Client;
1718

18-
class Google_Exception extends Exception
19+
class Google_Exception extends \Exception
1920
{
2021
}

lib/Google/src/Google/Http/Batch.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
namespace wpCloud\StatelessMedia\Google_Client;
1718

1819
use GuzzleHttp\Psr7;
1920
use GuzzleHttp\Psr7\Request;

0 commit comments

Comments
 (0)