Skip to content

Commit fe42e40

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 5c919f8 + cb79f17 commit fe42e40

File tree

6 files changed

+177
-10
lines changed

6 files changed

+177
-10
lines changed

docs/_sources/quickstart.rst.txt

+7-9
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ Here is the Complete example and what the result looks like in QuickBooks Online
196196
'accessTokenSecret' => "JqkHSBKzNHbqjMq0Njbcq8fjgJSpfjMvqHVWnDOW",
197197
'QBORealmID' => "193514464689044",
198198
'baseUrl' => "Development"
199-
));
200-
$dataService->setLogLocation("/Users/hlu2/Desktop/newFolderForLog");
201-
$dataService->throwExceptionOnError(true);
199+
))->setLogLocation("/Users/hlu2/Desktop/newFolderForLog")
200+
->throwExceptionOnError(true);
202201
//Add a new Invoice
203202
$invoiceToCreate = Invoice::create([
204203
"DocNumber" => "101",
@@ -260,9 +259,8 @@ Many QuickBooks Online users need to create entities with Tax. It is achieved on
260259
'refreshTokenKey' => "L011529104721Bb4GIrEKlXQ03Zw8pyGAHSsVxUt3prTKiNoVO",
261260
'QBORealmID' => "193514708967874",
262261
'baseUrl' => "Production"
263-
));
264-
$dataService->setLogLocation("/Users/hlu2/Desktop/newFolderForLog");
265-
$dataService->throwExceptionOnError(true);
262+
))->setLogLocation("/Users/hlu2/Desktop/newFolderForLog")
263+
->throwExceptionOnError(true);
266264
//Add a new Invoice
267265
$invoiceToCreate = Invoice::create([
268266
"DocNumber" => "101",
@@ -1101,9 +1099,9 @@ In V3 PHP SDK, the report service is separate from data service. To use the Repo
11011099
}
11021100
11031101
1104-
$reportService->setStartDate("2015-01-01");
1105-
$reportService->setAccountingMethod("Accrual");
1106-
$profitAndLossReport = $reportService->executeReport(ReportName::PROFITANDLOSS);
1102+
$profitAndLossReport = $reportService->setStartDate("2015-01-01")
1103+
->setAccountingMethod("Accrual")
1104+
->executeReport(ReportName::PROFITANDLOSS);
11071105
if (!$profitAndLossReport) {
11081106
exit("ProfitAndLossReport Is Null.\n");
11091107
} else {

src/DataService/DataService.php

+29-1
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,13 @@ public function updateServiceContextSettingsForOthers($serviceContext)
175175
/**
176176
* Set or Update the ServiceContext of this DataService.
177177
*
178-
* @var ServiceContext $serviceContext The new ServiceContext passed by.
178+
* @var ServiceContext $serviceContext The new ServiceContext passed by.
179+
* @return $this
179180
*/
180181
private function setupServiceContext($serviceContext)
181182
{
182183
$this->serviceContext = $serviceContext;
184+
return $this;
183185
}
184186

185187
/**
@@ -201,6 +203,7 @@ public function getServiceContext()
201203
* Set the SyncRest Handler for the DataService. If the client Name changed, the underlying Client that SyncRestHandler used will also changed.
202204
*
203205
* @var ServiceContext $serviceContext The service Context for this DataService
206+
* @return $this
204207
*
205208
*/
206209
protected function setupRestHandler($serviceContext)
@@ -211,6 +214,7 @@ protected function setupRestHandler($serviceContext)
211214
}else{
212215
throw new SdkException("Can not set the Rest Client based on null ServiceContext.");
213216
}
217+
return $this;
214218
}
215219

216220
/**
@@ -222,56 +226,71 @@ public function getClientName(){
222226
}
223227
/**
224228
* PHP SDK currently only support XML for Object Serialization and Deserialization, except for Report Service
229+
*
230+
* @return $this
225231
*/
226232
public function useXml()
227233
{
228234
$serviceContext = $this->getServiceContext();
229235
$serviceContext->useXml();
230236
$this->updateServiceContextSettingsForOthers($serviceContext);
237+
return $this;
231238
}
232239

233240
/**
234241
* PHP SDK currently only support XML for Object Serialization and Deserialization, except for Report Service
242+
*
243+
* @return $this
235244
*/
236245
public function useJson()
237246
{
238247
$serviceContext = $this->getServiceContext();
239248
$serviceContext->useJson();
240249
$this->updateServiceContextSettingsForOthers($serviceContext);
250+
return $this;
241251
}
242252

243253
/**
244254
* Set a new directory for request and response log
245255
*
246256
* @param String $new_log_location The directory path for storing request and response log
257+
*
258+
* @return $this
247259
*/
248260
public function setLogLocation($new_log_location)
249261
{
250262
$serviceContext = $this->getServiceContext();
251263
$serviceContext->setLogLocation($new_log_location);
252264
$this->updateServiceContextSettingsForOthers($serviceContext);
265+
return $this;
253266
}
254267

255268
/**
256269
* Set a new Minor Version
257270
*
258271
* @param String $newMinorVersion The new minor version that passed
272+
*
273+
* @return $this
259274
*/
260275
public function setMinorVersion($newMinorVersion)
261276
{
262277
$serviceContext = $this->getServiceContext();
263278
$serviceContext->setMinorVersion($newMinorVersion);
264279
$this->updateServiceContextSettingsForOthers($serviceContext);
280+
return $this;
265281
}
266282

267283
/**
268284
* Disable the logging function
285+
*
286+
* @return $this
269287
*/
270288
public function disableLog()
271289
{
272290
$serviceContext = $this->getServiceContext();
273291
$serviceContext->disableLog();
274292
$this->updateServiceContextSettingsForOthers($serviceContext);
293+
return $this;
275294
}
276295

277296

@@ -301,12 +320,16 @@ public function getClinetName(){
301320

302321
/**
303322
* The client Name can be either 'curl', 'guzzle', or 'guzzlehttp'.
323+
*
304324
* @param String $clientName The client Name used by the service
325+
*
326+
* @return $this
305327
*/
306328
public function setClientName($clientName){
307329
$this->clientName = $clientName;
308330
$serviceContext = $this->getServiceContext();
309331
$this->setupRestHandler($serviceContext);
332+
return $this;
310333
}
311334

312335
/**
@@ -395,7 +418,10 @@ public function getOAuth2LoginHelper()
395418

396419
/**
397420
* Update the OAuth 2 Token that will be used for API calls later.
421+
*
398422
* @param OAuth2AccessToken $newOAuth2AccessToken The OAuth 2 Access Token that will be used later.
423+
*
424+
* @return $this
399425
*/
400426
public function updateOAuth2Token($newOAuth2AccessToken)
401427
{
@@ -407,6 +433,7 @@ public function updateOAuth2Token($newOAuth2AccessToken)
407433
} catch (SdkException $e){
408434
echo $e->getTraceAsString();
409435
}
436+
return $this;
410437
}
411438

412439
/**
@@ -434,6 +461,7 @@ private function useMinorVersion()
434461
if (is_numeric($version) && !empty($version)) {
435462
$this->serviceContext->minorVersion = $version;
436463
}
464+
return $this;
437465
}
438466

439467
/**

src/DataService/IntuitBatchResponse.php

+3
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ public function AddEntities($entity)
9393
/**
9494
* Set the Entities to an entity list
9595
* @param Array $newEntities
96+
*
97+
* @return $this
9698
*/
9799
public function setEntities($newEntities){
98100
$this->entities = $newEntities;
101+
return $this;
99102
}
100103

101104
/**

src/Diagnostics/ContentWriter.php

+3
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ public function __construct($content = null)
5252
* Set prefix for a temporary filename.
5353
* It is used only by saveTemp()
5454
* @param string $prefix
55+
*
56+
* @return $this
5557
*/
5658
public function setPrefix($prefix)
5759
{
5860
$this->prefix = $prefix;
61+
return $this;
5962
}
6063

6164
/**

0 commit comments

Comments
 (0)