From 6ea5f952a7a4f198f8f92a1fc1483441455d07ca Mon Sep 17 00:00:00 2001 From: Salman Date: Thu, 4 May 2023 11:38:44 +0500 Subject: [PATCH] credentialsLoader patch --- src/Genlytics.php | 2 +- src/overrides/ApplicationDefaultCredentials.php | 8 ++++---- src/overrides/CredentialsWrapper.php | 4 ++-- src/overrides/Credentialsloader.php | 4 ++-- src/overrides/GapicClientTrait.php | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Genlytics.php b/src/Genlytics.php index 39cd256..abcd441 100644 --- a/src/Genlytics.php +++ b/src/Genlytics.php @@ -10,7 +10,7 @@ use Google\Analytics\Data\V1beta\DateRange; use Google\Analytics\Data\V1beta\Dimension; use Google\Analytics\Data\V1beta\Metric; -use Google\Auth\CredentialsLoader; +use Google\Auth\Credentialsloader; use Google\Service\AnalyticsReporting\DimensionFilter; use Throwable; diff --git a/src/overrides/ApplicationDefaultCredentials.php b/src/overrides/ApplicationDefaultCredentials.php index 05bb5c3..e9a66fc 100644 --- a/src/overrides/ApplicationDefaultCredentials.php +++ b/src/overrides/ApplicationDefaultCredentials.php @@ -160,7 +160,7 @@ public static function getCredentials( ) { $creds = null; - $jsonKey = CredentialsLoader::fromWellKnownFile(); + $jsonKey = Credentialsloader::fromWellKnownFile(); $anyScope = $scope ?: $defaultScope; if (!$httpHandler) { @@ -176,7 +176,7 @@ public static function getCredentials( if ($quotaProject) { $jsonKey['quota_project_id'] = $quotaProject; } - $creds = CredentialsLoader::makeCredentials( + $creds = Credentialsloader::makeCredentials( $scope, $jsonKey, $defaultScope @@ -272,8 +272,8 @@ public static function getIdTokenCredentials( CacheItemPoolInterface $cache = null ) { $creds = null; - $jsonKey = CredentialsLoader::fromEnv() - ?: CredentialsLoader::fromWellKnownFile(); + $jsonKey = Credentialsloader::fromEnv() + ?: Credentialsloader::fromWellKnownFile(); if (!$httpHandler) { if (!($client = HttpClientCache::getHttpClient())) { diff --git a/src/overrides/CredentialsWrapper.php b/src/overrides/CredentialsWrapper.php index 2d812d1..765f09f 100644 --- a/src/overrides/CredentialsWrapper.php +++ b/src/overrides/CredentialsWrapper.php @@ -9,7 +9,7 @@ use zfhassaan\genlytics\overrides\ApplicationDefaultCredentials; use Google\Auth\Cache\MemoryCacheItemPool; use Google\Auth\Credentials\ServiceAccountCredentials; -use Google\Auth\CredentialsLoader; +use Google\Auth\Credentialsloader; use Google\Auth\FetchAuthTokenCache; use Google\Auth\FetchAuthTokenInterface; use Google\Auth\GetQuotaProjectInterface; @@ -119,7 +119,7 @@ public static function build(array $args = []) $keyFile['quota_project_id'] = $args['quotaProject']; } - $loader = CredentialsLoader::makeCredentials( + $loader = Credentialsloader::makeCredentials( $args['scopes'], $keyFile, $args['defaultScopes'] diff --git a/src/overrides/Credentialsloader.php b/src/overrides/Credentialsloader.php index 33ad9ab..e617101 100644 --- a/src/overrides/Credentialsloader.php +++ b/src/overrides/Credentialsloader.php @@ -13,10 +13,10 @@ use UnexpectedValueException; /** - * CredentialsLoader contains the behaviour used to locate and find default + * Credentialsloader contains the behaviour used to locate and find default * credentials files on the file system. */ -abstract class CredentialsLoader implements +abstract class Credentialsloader implements FetchAuthTokenInterface, UpdateMetadataInterface { diff --git a/src/overrides/GapicClientTrait.php b/src/overrides/GapicClientTrait.php index 0e768a7..5d1938a 100644 --- a/src/overrides/GapicClientTrait.php +++ b/src/overrides/GapicClientTrait.php @@ -43,7 +43,7 @@ use Google\ApiCore\Transport\GrpcTransport; use zfhassaan\genlytics\overrides\RestTransport; use Google\ApiCore\Transport\TransportInterface; -use Google\Auth\CredentialsLoader; +use Google\Auth\Credentialsloader; use Google\Auth\FetchAuthTokenInterface; use Google\LongRunning\Operation; use Google\Protobuf\Internal\Message; @@ -235,8 +235,8 @@ private function buildClientOptions(array $options) // mTLS: detect and load the default clientCertSource if the environment variable // "GOOGLE_API_USE_CLIENT_CERTIFICATE" is true, and the cert source is available - if (empty($options['clientCertSource']) && CredentialsLoader::shouldLoadClientCertSource()) { - if ($defaultCertSource = CredentialsLoader::getDefaultClientCertSource()) { + if (empty($options['clientCertSource']) && Credentialsloader::shouldLoadClientCertSource()) { + if ($defaultCertSource = Credentialsloader::getDefaultClientCertSource()) { $options['clientCertSource'] = function () use ($defaultCertSource) { $cert = call_user_func($defaultCertSource);