@@ -91,18 +91,18 @@ class Gigya
9191 /**
9292 * @param string $apiKey
9393 * @param string $secretKey
94+ * @param string|null $dataCenter
9495 * @param string|null $userKey
95- * @param array $config Gigya configuration:
96- * - dataCenter <string> (Default: DC_EU) Data Center to use
97- * - auth <string> (Default: gigya) Type of authentication, gigya (HttpsAuth) is the
98- * default
99- * - uidValidator <bool> (Default: true) Include Uid Signature Validation
100- * - factory <object> (Default: null) A ResponseFactoryInterface to use, if none is
101- * provided ResponseFactory will be used
102- * - guzzle <array> (Default: []) A configuration to pass to guzzle if required
103- * - options <array> (Default: []) A set of options to pass to each request
96+ * @param array $config Gigya configuration:
97+ * - auth <string> (Default: gigya) Type of authentication, gigya (HttpsAuth) is the
98+ * default
99+ * - uidValidator <bool> (Default: true) Include Uid Signature Validation
100+ * - factory <object> (Default: null) A ResponseFactoryInterface to use, if none is
101+ * provided ResponseFactory will be used
102+ * - guzzle <array> (Default: []) A configuration to pass to guzzle if required
103+ * - options <array> (Default: []) A set of options to pass to each request
104104 */
105- public function __construct ($ apiKey , $ secretKey , $ userKey = null , array $ config = [])
105+ public function __construct ($ apiKey , $ secretKey , $ dataCenter = null , $ userKey = null , array $ config = [])
106106 {
107107 $ guzzleConfig = (isset ($ config ['guzzle ' ])) ? $ config ['guzzle ' ] : [];
108108 $ this ->guzzle = new GuzzleClient ($ guzzleConfig );
@@ -126,7 +126,7 @@ public function __construct($apiKey, $secretKey, $userKey = null, array $config
126126 if (isset ($ config ['factory ' ])) {
127127 $ this ->setFactory ($ config ['factory ' ]);
128128 }
129- $ this ->dataCenter = ( isset ( $ config [ ' dataCenter ' ])) ? $ config [ ' dataCenter ' ] : self ::DC_EU ;
129+ $ this ->dataCenter = $ dataCenter ?: static ::DC_EU ;
130130 }
131131
132132 /**
@@ -224,7 +224,7 @@ public function __call($method, array $arguments)
224224 throw new BadMethodCallException ('No Arguments should be supplied for Gigya call ' );
225225 }
226226
227- return $ this ->clientFactory ($ method );
227+ return $ this ->endpointFactory ($ method );
228228 }
229229
230230 /**
@@ -233,7 +233,7 @@ public function __call($method, array $arguments)
233233 *
234234 * @return Client
235235 */
236- private function clientFactory ($ namespace , $ className = Client::class)
236+ private function endpointFactory ($ namespace , $ className = Client::class)
237237 {
238238 return new $ className (
239239 $ this ->guzzle ,
@@ -251,70 +251,70 @@ private function clientFactory($namespace, $className = Client::class)
251251 */
252252 public function accounts ()
253253 {
254- return $ this ->clientFactory (static ::NAMESPACE_ACCOUNTS , Accounts::class);
254+ return $ this ->endpointFactory (static ::NAMESPACE_ACCOUNTS , Accounts::class);
255255 }
256256
257257 /**
258258 * @return Audit
259259 */
260260 public function audit ()
261261 {
262- return $ this ->clientFactory (static ::NAMESPACE_AUDIT , Audit::class);
262+ return $ this ->endpointFactory (static ::NAMESPACE_AUDIT , Audit::class);
263263 }
264264
265265 /**
266266 * @return Socialize
267267 */
268268 public function socialize ()
269269 {
270- return $ this ->clientFactory (static ::NAMESPACE_SOCIALIZE , Socialize::class);
270+ return $ this ->endpointFactory (static ::NAMESPACE_SOCIALIZE , Socialize::class);
271271 }
272272
273273 /**
274274 * @return Comments
275275 */
276276 public function comments ()
277277 {
278- return $ this ->clientFactory (static ::NAMESPACE_COMMENTS , Comments::class);
278+ return $ this ->endpointFactory (static ::NAMESPACE_COMMENTS , Comments::class);
279279 }
280280
281281 /**
282282 * @return GameMechanics
283283 */
284284 public function gameMechanics ()
285285 {
286- return $ this ->clientFactory (static ::NAMESPACE_GAME_MECHANICS , GameMechanics::class);
286+ return $ this ->endpointFactory (static ::NAMESPACE_GAME_MECHANICS , GameMechanics::class);
287287 }
288288
289289 /**
290290 * @return Reports
291291 */
292292 public function reports ()
293293 {
294- return $ this ->clientFactory (static ::NAMESPACE_REPORTS , Reports::class);
294+ return $ this ->endpointFactory (static ::NAMESPACE_REPORTS , Reports::class);
295295 }
296296
297297 /**
298298 * @return DataStore
299299 */
300300 public function dataStore ()
301301 {
302- return $ this ->clientFactory (static ::NAMESPACE_DATA_STORE , DataStore::class);
302+ return $ this ->endpointFactory (static ::NAMESPACE_DATA_STORE , DataStore::class);
303303 }
304304
305305 /**
306306 * @return IdentityStorage
307307 */
308308 public function identityStorage ()
309309 {
310- return $ this ->clientFactory (static ::NAMESPACE_IDENTITY_STORAGE , IdentityStorage::class);
310+ return $ this ->endpointFactory (static ::NAMESPACE_IDENTITY_STORAGE , IdentityStorage::class);
311311 }
312312
313313 /**
314314 * @return Saml
315315 */
316316 public function saml ()
317317 {
318- return $ this ->clientFactory (static ::NAMESPACE_FIDM , Saml::class);
318+ return $ this ->endpointFactory (static ::NAMESPACE_FIDM , Saml::class);
319319 }
320320}
0 commit comments