@@ -131,7 +131,7 @@ |
||
| 131 | 131 | * @return mixed |
| 132 | 132 | */ |
| 133 | 133 | public function getSalesInvoiceLines() { |
| 134 | - if(array_key_exists('__deferred', $this->attributes['SalesInvoiceLines'])) { |
|
| 134 | + if (array_key_exists('__deferred', $this->attributes['SalesInvoiceLines'])) { |
|
| 135 | 135 | $this->attributes['SalesInvoiceLines'] = (new SalesInvoiceLine($this->connection()))->filter("InvoiceID eq guid'{$this->InvoiceID}'"); |
| 136 | 136 | } |
| 137 | 137 | return $this->attributes['SalesInvoiceLines']; |
@@ -42,8 +42,8 @@ |
||
| 42 | 42 | |
| 43 | 43 | public function addItem(array $array) |
| 44 | 44 | { |
| 45 | - if ( ! isset( $this->attributes['GeneralJournalEntryLines'] ) || $this->attributes['GeneralJournalEntryLines'] == null) { |
|
| 46 | - $this->attributes['GeneralJournalEntryLines'] = [ ]; |
|
| 45 | + if ( ! isset($this->attributes['GeneralJournalEntryLines']) || $this->attributes['GeneralJournalEntryLines'] == null) { |
|
| 46 | + $this->attributes['GeneralJournalEntryLines'] = []; |
|
| 47 | 47 | } |
| 48 | 48 | $this->attributes['GeneralJournalEntryLines'][] = $array; |
| 49 | 49 | } |
@@ -358,8 +358,7 @@ |
||
| 358 | 358 | if (array_key_exists('d', $json)) { |
| 359 | 359 | if (array_key_exists('__next', $json['d'])) { |
| 360 | 360 | $this->nextUrl = $json['d']['__next']; |
| 361 | - } |
|
| 362 | - else { |
|
| 361 | + } else { |
|
| 363 | 362 | $this->nextUrl = null; |
| 364 | 363 | } |
| 365 | 364 | |
@@ -94,8 +94,8 @@ |
||
| 94 | 94 | protected $middleWares = []; |
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | - * @var string|null |
|
| 98 | - */ |
|
| 97 | + * @var string|null |
|
| 98 | + */ |
|
| 99 | 99 | public $nextUrl = null; |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | { |
| 249 | 249 | if ($this->pauseForMinuteLimitEnabled()) { |
| 250 | 250 | // take 90% of callsLimit so we have some tolerance when multiple process are running |
| 251 | - if($this->callsLeft <= ($this->callsLimit * 0.10)) { |
|
| 251 | + if ($this->callsLeft <= ($this->callsLimit * 0.10)) { |
|
| 252 | 252 | sleep(60); |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -296,12 +296,12 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // If we have a token, sign the request |
| 299 | - if (!$this->needsAuthentication() && !empty($this->accessToken)) { |
|
| 299 | + if ( ! $this->needsAuthentication() && ! empty($this->accessToken)) { |
|
| 300 | 300 | $headers['Authorization'] = 'Bearer ' . $this->accessToken; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | // Create param string |
| 304 | - if (!empty($params)) { |
|
| 304 | + if ( ! empty($params)) { |
|
| 305 | 305 | $endpoint .= '?' . http_build_query($params); |
| 306 | 306 | } |
| 307 | 307 | |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | */ |
| 630 | 630 | private function getTimestampFromExpiresIn($expiresIn) |
| 631 | 631 | { |
| 632 | - if (!ctype_digit($expiresIn)) { |
|
| 632 | + if ( ! ctype_digit($expiresIn)) { |
|
| 633 | 633 | throw new \InvalidArgumentException('Function requires a numeric expires value'); |
| 634 | 634 | } |
| 635 | 635 | |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | */ |
| 728 | 728 | private function parseExceptionForErrorMessages(Exception $e) |
| 729 | 729 | { |
| 730 | - if (! $e instanceof BadResponseException) { |
|
| 730 | + if ( ! $e instanceof BadResponseException) { |
|
| 731 | 731 | throw new ApiException($e->getMessage()); |
| 732 | 732 | } |
| 733 | 733 | |
@@ -736,13 +736,13 @@ discard block |
||
| 736 | 736 | $responseBody = $response->getBody()->getContents(); |
| 737 | 737 | $decodedResponseBody = json_decode($responseBody, true); |
| 738 | 738 | |
| 739 | - if (! is_null($decodedResponseBody) && isset($decodedResponseBody['error']['message']['value'])) { |
|
| 739 | + if ( ! is_null($decodedResponseBody) && isset($decodedResponseBody['error']['message']['value'])) { |
|
| 740 | 740 | $errorMessage = $decodedResponseBody['error']['message']['value']; |
| 741 | 741 | } else { |
| 742 | 742 | $errorMessage = $responseBody; |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | - throw new ApiException('Error ' . $response->getStatusCode() .': ' . $errorMessage); |
|
| 745 | + throw new ApiException('Error ' . $response->getStatusCode() . ': ' . $errorMessage); |
|
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | /** |
@@ -124,10 +124,10 @@ |
||
| 124 | 124 | */ |
| 125 | 125 | public function addItem(array $array) |
| 126 | 126 | { |
| 127 | - if (! isset($this->attributes['PurchaseOrderLines']) || $this->attributes['PurchaseOrderLines'] == null) { |
|
| 127 | + if ( ! isset($this->attributes['PurchaseOrderLines']) || $this->attributes['PurchaseOrderLines'] == null) { |
|
| 128 | 128 | $this->attributes['PurchaseOrderLines'] = []; |
| 129 | 129 | } |
| 130 | - if (! isset($array['LineNumber'])) { |
|
| 130 | + if ( ! isset($array['LineNumber'])) { |
|
| 131 | 131 | $array['LineNumber'] = count($this->attributes['PurchaseOrderLines']) + 1; |
| 132 | 132 | } |
| 133 | 133 | $this->attributes['PurchaseOrderLines'][] = $array; |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | |
| 53 | 53 | public function addItem(array $array) |
| 54 | 54 | { |
| 55 | - if (! isset($this->attributes['CashEntryLines']) || $this->attributes['CashEntryLines'] == null) { |
|
| 55 | + if ( ! isset($this->attributes['CashEntryLines']) || $this->attributes['CashEntryLines'] == null) { |
|
| 56 | 56 | $this->attributes['CashEntryLines'] = []; |
| 57 | 57 | } |
| 58 | 58 | $this->attributes['CashEntryLines'][] = $array; |
@@ -142,10 +142,10 @@ |
||
| 142 | 142 | */ |
| 143 | 143 | public function addItem(array $array) |
| 144 | 144 | { |
| 145 | - if (! isset($this->attributes['SalesOrderLines']) || $this->attributes['SalesOrderLines'] == null) { |
|
| 145 | + if ( ! isset($this->attributes['SalesOrderLines']) || $this->attributes['SalesOrderLines'] == null) { |
|
| 146 | 146 | $this->attributes['SalesOrderLines'] = []; |
| 147 | 147 | } |
| 148 | - if (! isset($array['LineNumber'])) { |
|
| 148 | + if ( ! isset($array['LineNumber'])) { |
|
| 149 | 149 | $array['LineNumber'] = count($this->attributes['SalesOrderLines']) + 1; |
| 150 | 150 | } |
| 151 | 151 | $this->attributes['SalesOrderLines'][] = $array; |
@@ -144,8 +144,7 @@ |
||
| 144 | 144 | |
| 145 | 145 | return true; |
| 146 | 146 | } |
| 147 | - } |
|
| 148 | - catch (\Exception $e) { |
|
| 147 | + } catch (\Exception $e) { |
|
| 149 | 148 | // We tried lets leave it as is. |
| 150 | 149 | } |
| 151 | 150 | |
@@ -241,7 +241,7 @@ |
||
| 241 | 241 | |
| 242 | 242 | $attributes[$attribute] = []; |
| 243 | 243 | foreach ($collection as $value) { |
| 244 | - if(!empty($value->deferred)) { |
|
| 244 | + if ( ! empty($value->deferred)) { |
|
| 245 | 245 | $value->attributes = array_merge($value->attributes, $value->deferred); |
| 246 | 246 | } |
| 247 | 247 | |
@@ -112,10 +112,10 @@ |
||
| 112 | 112 | |
| 113 | 113 | public function addItem(array $array) |
| 114 | 114 | { |
| 115 | - if (! isset($this->attributes['SalesEntryLines']) || $this->attributes['SalesEntryLines'] == null) { |
|
| 115 | + if ( ! isset($this->attributes['SalesEntryLines']) || $this->attributes['SalesEntryLines'] == null) { |
|
| 116 | 116 | $this->attributes['SalesEntryLines'] = []; |
| 117 | 117 | } |
| 118 | - if (! isset($array['LineNumber'])) { |
|
| 118 | + if ( ! isset($array['LineNumber'])) { |
|
| 119 | 119 | $array['LineNumber'] = count($this->attributes['SalesEntryLines']) + 1; |
| 120 | 120 | } |
| 121 | 121 | $this->attributes['SalesEntryLines'][] = $array; |
@@ -67,10 +67,10 @@ |
||
| 67 | 67 | |
| 68 | 68 | public function addItem(array $array) |
| 69 | 69 | { |
| 70 | - if (! isset($this->attributes['PurchaseEntryLines']) || $this->attributes['PurchaseEntryLines'] == null) { |
|
| 70 | + if ( ! isset($this->attributes['PurchaseEntryLines']) || $this->attributes['PurchaseEntryLines'] == null) { |
|
| 71 | 71 | $this->attributes['PurchaseEntryLines'] = []; |
| 72 | 72 | } |
| 73 | - if (! isset($array['LineNumber'])) { |
|
| 73 | + if ( ! isset($array['LineNumber'])) { |
|
| 74 | 74 | $array['LineNumber'] = count($this->attributes['PurchaseEntryLines']) + 1; |
| 75 | 75 | } |
| 76 | 76 | $this->attributes['PurchaseEntryLines'][] = $array; |