Skip to content

Commit b8f8bfd

Browse files
committed
merge all pull requests
Fix #93, #92,
1 parent 3882e86 commit b8f8bfd

File tree

12 files changed

+39
-52
lines changed

12 files changed

+39
-52
lines changed

src/Core/Http/Serialization/XmlObjectSerializer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ public function Deserialize($message, $bLimitToOne = false)
233233
$resultObjects = null;
234234

235235
$responseXmlObj = simplexml_load_string($message);
236+
237+
//handle count(*) case, for example Select count(*) from Invoice
238+
if(isset($responseXmlObj->attributes()['totalCount']) && !isset($responseXmlObj->attributes()['startPosition'])){
239+
return (int) $responseXmlObj->attributes()['totalCount'];
240+
}
241+
236242
foreach ($responseXmlObj as $oneXmlObj) {
237243
$oneXmlElementName = (string)$oneXmlObj->getName();
238244

src/Core/HttpClients/BaseCurl.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,3 @@ public function close()
149149
$this->curl = null;
150150
}
151151
}
152-
153-
?>

src/Core/HttpClients/ClientFactory.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,3 @@ public static function createClient($clientName = CoreConstants::CLIENT_CURL){
5555
throw new SdkException("The client Name you passed is not supported. Please use either 'curl' or 'guzzle' for the client Name.");
5656
}
5757
}
58-
59-
60-
?>

src/Core/HttpClients/CurlHttpClient.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,5 +194,3 @@ public function getLastResponse(){
194194
}
195195

196196
}
197-
198-
?>

src/Core/HttpClients/FaultHandler.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,4 @@ public function getIntuitErrorMessage(){
292292
public function getIntuitErrorDetail(){
293293
return $this->intuitErrorDetail;
294294
}
295-
296-
297-
298295
}

src/Core/HttpClients/GuzzleHttpClient.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,4 @@ public function getLastResponse(){
121121
public function clearResponse(){
122122
$this->intuitResponse = false;
123123
}
124-
125-
}
126-
127-
?>
124+
}

src/Core/HttpClients/HttpClientInterface.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,4 @@ public function getLastResponse();
6060
* @param mix The response from the http client
6161
*/
6262
public function setIntuitResponse($response);
63-
}
64-
?>
63+
}

src/Core/OAuth/OAuth2/OAuth2AccessToken.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,5 +354,3 @@ private function getDateFromSeconds($seconds){
354354
return date('Y/m/d H:i:s', $seconds);
355355
}
356356
}
357-
358-
?>

src/Core/OAuth/OAuth2/OAuth2LoginHelper.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,5 +389,3 @@ private function constructRefreshTokenBody($refresh_token){
389389
return http_build_query($parameters);
390390
}
391391
}
392-
393-
?>

src/DataService/DataService.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public static function Configure($settings)
335335

336336
}
337337

338-
if($ServiceContext->IppConfiguration->OAuthMode = CoreConstants::OAUTH2)
338+
if($ServiceContext->IppConfiguration->OAuthMode == CoreConstants::OAUTH2)
339339
{
340340
$oauth2Config = $ServiceContext->IppConfiguration->Security;
341341
if($oauth2Config instanceof OAuth2AccessToken){
@@ -357,7 +357,8 @@ public static function Configure($settings)
357357
* @param OAuth2AccessToken $oauth2Conifg OAuth 2 Token related information
358358
* @param Array $settings The array that include the redirectURL, scope, state information
359359
*/
360-
private function configureOAuth2LoginHelper($oauth2Conifg, $settings){
360+
private function configureOAuth2LoginHelper($oauth2Conifg, $settings)
361+
{
361362
$refreshToken = CoreConstants::getRefreshTokenFromArray($settings);
362363
if(isset($refreshToken)){
363364
//Login helper for refresh token API call
@@ -385,15 +386,17 @@ private function configureOAuth2LoginHelper($oauth2Conifg, $settings){
385386
* Return the OAuth 2 Login Helper. The OAuth 2 Login helper can be used to generate OAuth code, get refresh Token, etc.
386387
* @return $OAuth2LoginHelper A helper to get OAuth 2 related values.
387388
*/
388-
public function getOAuth2LoginHelper(){
389+
public function getOAuth2LoginHelper()
390+
{
389391
return $this->OAuth2LoginHelper;
390392
}
391393

392394
/**
393395
* Update the OAuth 2 Token that will be used for API calls later.
394396
* @param OAuth2AccessToken $newOAuth2AccessToken The OAuth 2 Access Token that will be used later.
395397
*/
396-
public function updateOAuth2Token($newOAuth2AccessToken){
398+
public function updateOAuth2Token($newOAuth2AccessToken)
399+
{
397400
try{
398401
$this->serviceContext->updateOAuth2Token($newOAuth2AccessToken);
399402
$realmID = $newOAuth2AccessToken->getRealmID();
@@ -585,7 +588,7 @@ private function sendRequestParseResponseBodyAndHandleHttpError($entity, $uri, $
585588
$requestParameters = $this->getPostRequestParameters($uri, "multipart/form-data; boundary={$boundaryString}");
586589
break;
587590
case DataService::SENDEMAIL:
588-
$requestParameters = $this->getPostRequestParameters($uri . (is_null($email) ? '' : '?sendTo=' . $email), CoreConstants::CONTENTTYPE_OCTETSTREAM);
591+
$requestParameters = $this->getPostRequestParameters($uri . (is_null($email) ? '' : '?sendTo=' . urlencode($email)), CoreConstants::CONTENTTYPE_OCTETSTREAM);
589592
break;
590593
}
591594
//$restRequestHandler = new SyncRestHandler($this->serviceContext);

0 commit comments

Comments
 (0)