@@ -105,47 +105,84 @@ class Client
105
105
/**
106
106
* Construct the Google Client.
107
107
*
108
- * @param array $config
108
+ * @param array $config {
109
+ * An array of required and optional arguments.
110
+ *
111
+ * @type string $application_name
112
+ * The name of your application
113
+ * @type string $base_path
114
+ * The base URL for the service. This is only accounted for when calling
115
+ * {@see Client::authorize()} directly.
116
+ * @type string $client_id
117
+ * Your Google Cloud client ID found in https://developers.google.com/console
118
+ * @type string $client_secret
119
+ * Your Google Cloud client secret found in https://developers.google.com/console
120
+ * @type string|array|CredentialsLoader $credentials
121
+ * Can be a path to JSON credentials or an array representing those
122
+ * credentials (@see Google\Client::setAuthConfig), or an instance of
123
+ * {@see CredentialsLoader}.
124
+ * @type string|array $scopes
125
+ * {@see Google\Client::setScopes}
126
+ * @type string $quota_project
127
+ * Sets X-Goog-User-Project, which specifies a user project to bill
128
+ * for access charges associated with the request.
129
+ * @type string $redirect_uri
130
+ * @type string $state
131
+ * @type string $developer_key
132
+ * Simple API access key, also from the API console. Ensure you get
133
+ * a Server key, and not a Browser key.
134
+ * @type bool $use_application_default_credentials
135
+ * For use with Google Cloud Platform
136
+ * fetch the ApplicationDefaultCredentials, if applicable
137
+ * {@see https://developers.google.com/identity/protocols/application-default-credentials}
138
+ * @type string $signing_key
139
+ * @type string $signing_algorithm
140
+ * @type string $subject
141
+ * @type string $hd
142
+ * @type string $prompt
143
+ * @type string $openid
144
+ * @type bool $include_granted_scopes
145
+ * @type string $login_hint
146
+ * @type string $request_visible_actions
147
+ * @type string $access_type
148
+ * @type string $approval_prompt
149
+ * @type array $retry
150
+ * Task Runner retry configuration
151
+ * {@see \Google\Task\Runner}
152
+ * @type array $retry_map
153
+ * @type CacheItemPoolInterface $cache
154
+ * Cache class implementing {@see CacheItemPoolInterface}. Defaults
155
+ * to {@see MemoryCacheItemPool}.
156
+ * @type array $cache_config
157
+ * Cache config for downstream auth caching.
158
+ * @type callable $token_callback
159
+ * Function to be called when an access token is fetched. Follows
160
+ * the signature `function (string $cacheKey, string $accessToken)`.
161
+ * @type \Firebase\JWT $jwt
162
+ * Service class used in {@see Client::verifyIdToken()}. Explicitly
163
+ * pass this in to avoid setting {@see \Firebase\JWT::$leeway}
164
+ * @type bool $api_format_v2
165
+ * Setting api_format_v2 will return more detailed error messages
166
+ * from certain APIs.
167
+ * }
109
168
*/
110
169
public function __construct (array $ config = [])
111
170
{
112
171
$ this ->config = array_merge ([
113
172
'application_name ' => '' ,
114
-
115
- // Don't change these unless you're working against a special development
116
- // or testing environment.
117
173
'base_path ' => self ::API_BASE_PATH ,
118
-
119
- // https://developers.google.com/console
120
174
'client_id ' => '' ,
121
175
'client_secret ' => '' ,
122
-
123
- // Can be a path to JSON credentials or an array representing those
124
- // credentials (@see Google\Client::setAuthConfig), or an instance of
125
- // Google\Auth\CredentialsLoader.
126
176
'credentials ' => null ,
127
- // @see Google\Client::setScopes
128
177
'scopes ' => null ,
129
- // Sets X-Goog-User-Project, which specifies a user project to bill
130
- // for access charges associated with the request
131
178
'quota_project ' => null ,
132
-
133
179
'redirect_uri ' => null ,
134
180
'state ' => null ,
135
-
136
- // Simple API access key, also from the API console. Ensure you get
137
- // a Server key, and not a Browser key.
138
181
'developer_key ' => '' ,
139
-
140
- // For use with Google Cloud Platform
141
- // fetch the ApplicationDefaultCredentials, if applicable
142
- // @see https://developers.google.com/identity/protocols/application-default-credentials
143
182
'use_application_default_credentials ' => false ,
144
183
'signing_key ' => null ,
145
184
'signing_algorithm ' => null ,
146
185
'subject ' => null ,
147
-
148
- // Other OAuth2 parameters.
149
186
'hd ' => '' ,
150
187
'prompt ' => '' ,
151
188
'openid.realm ' => '' ,
@@ -154,28 +191,12 @@ public function __construct(array $config = [])
154
191
'request_visible_actions ' => '' ,
155
192
'access_type ' => 'online ' ,
156
193
'approval_prompt ' => 'auto ' ,
157
-
158
- // Task Runner retry configuration
159
- // @see Google\Task\Runner
160
194
'retry ' => [],
161
195
'retry_map ' => null ,
162
-
163
- // Cache class implementing Psr\Cache\CacheItemPoolInterface.
164
- // Defaults to Google\Auth\Cache\MemoryCacheItemPool.
165
196
'cache ' => null ,
166
- // cache config for downstream auth caching
167
197
'cache_config ' => [],
168
-
169
- // function to be called when an access token is fetched
170
- // follows the signature function ($cacheKey, $accessToken)
171
198
'token_callback ' => null ,
172
-
173
- // Service class used in Google\Client::verifyIdToken.
174
- // Explicitly pass this in to avoid setting JWT::$leeway
175
199
'jwt ' => null ,
176
-
177
- // Setting api_format_v2 will return more detailed error messages
178
- // from certain APIs.
179
200
'api_format_v2 ' => false
180
201
], $ config );
181
202
0 commit comments