@@ -37,13 +37,13 @@ class ImpersonatedServiceAccountCredentials extends CredentialsLoader implements
3737 protected $ sourceCredentials ;
3838
3939 /**
40- * Instantiate an instance of ImpersonatedServiceAccountCredentials from a credentials file that has be created with
41- * the --impersonated-service-account flag.
40+ * Instantiate an instance of ImpersonatedServiceAccountCredentials from a credentials file that
41+ * has be created with the --impersonated-service-account flag.
4242 *
43- * @param string|string[] $scope the scope of the access request, expressed
44- * either as an Array or as a space-delimited String .
43+ * @param string|string[] $scope The scope of the access request, expressed either as an
44+ * array or as a space-delimited string .
4545 * @param string|array<mixed> $jsonKey JSON credential file path or JSON credentials
46- * as an associative array
46+ * as an associative array.
4747 */
4848 public function __construct (
4949 $ scope ,
@@ -59,24 +59,34 @@ public function __construct(
5959 }
6060 }
6161 if (!array_key_exists ('service_account_impersonation_url ' , $ jsonKey )) {
62- throw new \LogicException ('json key is missing the service_account_impersonation_url field ' );
62+ throw new \LogicException (
63+ 'json key is missing the service_account_impersonation_url field '
64+ );
6365 }
6466 if (!array_key_exists ('source_credentials ' , $ jsonKey )) {
6567 throw new \LogicException ('json key is missing the source_credentials field ' );
6668 }
6769
68- $ this ->impersonatedServiceAccountName = $ this ->getImpersonatedServiceAccountNameFromUrl ($ jsonKey ['service_account_impersonation_url ' ]);
70+ $ this ->impersonatedServiceAccountName = $ this ->getImpersonatedServiceAccountNameFromUrl (
71+ $ jsonKey ['service_account_impersonation_url ' ]
72+ );
6973
70- $ this ->sourceCredentials = new UserRefreshCredentials ($ scope , $ jsonKey ['source_credentials ' ]);
74+ $ this ->sourceCredentials = new UserRefreshCredentials (
75+ $ scope ,
76+ $ jsonKey ['source_credentials ' ]
77+ );
7178 }
7279
7380 /**
74- * Helper function for extracting the Server Account Name from the URL saved in the account credentials file
75- * @param $serviceAccountImpersonationUrl string URL from the 'service_account_impersonation_url' field
81+ * Helper function for extracting the Server Account Name from the URL saved in the account
82+ * credentials file.
83+ *
84+ * @param $serviceAccountImpersonationUrl string URL from "service_account_impersonation_url"
7685 * @return string Service account email or ID.
7786 */
78- private function getImpersonatedServiceAccountNameFromUrl (string $ serviceAccountImpersonationUrl )
79- {
87+ private function getImpersonatedServiceAccountNameFromUrl (
88+ string $ serviceAccountImpersonationUrl
89+ ): string {
8090 $ fields = explode ('/ ' , $ serviceAccountImpersonationUrl );
8191 $ lastField = end ($ fields );
8292 $ splitter = explode (': ' , $ lastField );
0 commit comments