1414 * See the License for the specific language governing permissions and
1515 * limitations under the License.
1616 */
17+ namespace wpCloud \StatelessMedia \Google_Client ;
1718
1819use Google \Auth \ApplicationDefaultCredentials ;
1920use 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 );
0 commit comments