@@ -175,11 +175,13 @@ public function updateServiceContextSettingsForOthers($serviceContext)
175
175
/**
176
176
* Set or Update the ServiceContext of this DataService.
177
177
*
178
- * @var ServiceContext $serviceContext The new ServiceContext passed by.
178
+ * @var ServiceContext $serviceContext The new ServiceContext passed by.
179
+ * @return $this
179
180
*/
180
181
private function setupServiceContext ($ serviceContext )
181
182
{
182
183
$ this ->serviceContext = $ serviceContext ;
184
+ return $ this ;
183
185
}
184
186
185
187
/**
@@ -201,6 +203,7 @@ public function getServiceContext()
201
203
* Set the SyncRest Handler for the DataService. If the client Name changed, the underlying Client that SyncRestHandler used will also changed.
202
204
*
203
205
* @var ServiceContext $serviceContext The service Context for this DataService
206
+ * @return $this
204
207
*
205
208
*/
206
209
protected function setupRestHandler ($ serviceContext )
@@ -211,6 +214,7 @@ protected function setupRestHandler($serviceContext)
211
214
}else {
212
215
throw new SdkException ("Can not set the Rest Client based on null ServiceContext. " );
213
216
}
217
+ return $ this ;
214
218
}
215
219
216
220
/**
@@ -222,56 +226,71 @@ public function getClientName(){
222
226
}
223
227
/**
224
228
* PHP SDK currently only support XML for Object Serialization and Deserialization, except for Report Service
229
+ *
230
+ * @return $this
225
231
*/
226
232
public function useXml ()
227
233
{
228
234
$ serviceContext = $ this ->getServiceContext ();
229
235
$ serviceContext ->useXml ();
230
236
$ this ->updateServiceContextSettingsForOthers ($ serviceContext );
237
+ return $ this ;
231
238
}
232
239
233
240
/**
234
241
* PHP SDK currently only support XML for Object Serialization and Deserialization, except for Report Service
242
+ *
243
+ * @return $this
235
244
*/
236
245
public function useJson ()
237
246
{
238
247
$ serviceContext = $ this ->getServiceContext ();
239
248
$ serviceContext ->useJson ();
240
249
$ this ->updateServiceContextSettingsForOthers ($ serviceContext );
250
+ return $ this ;
241
251
}
242
252
243
253
/**
244
254
* Set a new directory for request and response log
245
255
*
246
256
* @param String $new_log_location The directory path for storing request and response log
257
+ *
258
+ * @return $this
247
259
*/
248
260
public function setLogLocation ($ new_log_location )
249
261
{
250
262
$ serviceContext = $ this ->getServiceContext ();
251
263
$ serviceContext ->setLogLocation ($ new_log_location );
252
264
$ this ->updateServiceContextSettingsForOthers ($ serviceContext );
265
+ return $ this ;
253
266
}
254
267
255
268
/**
256
269
* Set a new Minor Version
257
270
*
258
271
* @param String $newMinorVersion The new minor version that passed
272
+ *
273
+ * @return $this
259
274
*/
260
275
public function setMinorVersion ($ newMinorVersion )
261
276
{
262
277
$ serviceContext = $ this ->getServiceContext ();
263
278
$ serviceContext ->setMinorVersion ($ newMinorVersion );
264
279
$ this ->updateServiceContextSettingsForOthers ($ serviceContext );
280
+ return $ this ;
265
281
}
266
282
267
283
/**
268
284
* Disable the logging function
285
+ *
286
+ * @return $this
269
287
*/
270
288
public function disableLog ()
271
289
{
272
290
$ serviceContext = $ this ->getServiceContext ();
273
291
$ serviceContext ->disableLog ();
274
292
$ this ->updateServiceContextSettingsForOthers ($ serviceContext );
293
+ return $ this ;
275
294
}
276
295
277
296
@@ -301,12 +320,16 @@ public function getClinetName(){
301
320
302
321
/**
303
322
* The client Name can be either 'curl', 'guzzle', or 'guzzlehttp'.
323
+ *
304
324
* @param String $clientName The client Name used by the service
325
+ *
326
+ * @return $this
305
327
*/
306
328
public function setClientName ($ clientName ){
307
329
$ this ->clientName = $ clientName ;
308
330
$ serviceContext = $ this ->getServiceContext ();
309
331
$ this ->setupRestHandler ($ serviceContext );
332
+ return $ this ;
310
333
}
311
334
312
335
/**
@@ -395,7 +418,10 @@ public function getOAuth2LoginHelper()
395
418
396
419
/**
397
420
* Update the OAuth 2 Token that will be used for API calls later.
421
+ *
398
422
* @param OAuth2AccessToken $newOAuth2AccessToken The OAuth 2 Access Token that will be used later.
423
+ *
424
+ * @return $this
399
425
*/
400
426
public function updateOAuth2Token ($ newOAuth2AccessToken )
401
427
{
@@ -407,6 +433,7 @@ public function updateOAuth2Token($newOAuth2AccessToken)
407
433
} catch (SdkException $ e ){
408
434
echo $ e ->getTraceAsString ();
409
435
}
436
+ return $ this ;
410
437
}
411
438
412
439
/**
@@ -434,6 +461,7 @@ private function useMinorVersion()
434
461
if (is_numeric ($ version ) && !empty ($ version )) {
435
462
$ this ->serviceContext ->minorVersion = $ version ;
436
463
}
464
+ return $ this ;
437
465
}
438
466
439
467
/**
0 commit comments