Passed
Pull Request — master (#348)
by
unknown
02:57
created
src/Picqer/Financials/Exact/CashEntry.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
example/example.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Autoload composer installed libraries
4
-require __DIR__.'/../vendor/autoload.php';
4
+require __DIR__ . '/../vendor/autoload.php';
5 5
 
6 6
 /**
7 7
  * Function to retrieve persisted data for the example.
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     try {
101 101
         $connection->connect();
102 102
     } catch (\Exception $e) {
103
-        throw new Exception('Could not connect to Exact: '.$e->getMessage());
103
+        throw new Exception('Could not connect to Exact: ' . $e->getMessage());
104 104
     }
105 105
 
106 106
     return $connection;
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
     $journals = new \Picqer\Financials\Exact\Journal($connection);
125 125
     $result = $journals->get();
126 126
     foreach ($result as $journal) {
127
-        echo 'Journal: '.$journal->Description.'<br>';
127
+        echo 'Journal: ' . $journal->Description . '<br>';
128 128
     }
129 129
 } catch (\Exception $e) {
130
-    echo get_class($e).' : '.$e->getMessage();
130
+    echo get_class($e) . ' : ' . $e->getMessage();
131 131
 }
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/PurchaseOrder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,10 +123,10 @@
 block discarded – undo
123 123
      */
124 124
     public function addItem(array $array)
125 125
     {
126
-        if (!isset($this->attributes['PurchaseOrderLines']) || $this->attributes['PurchaseOrderLines'] == null) {
126
+        if ( ! isset($this->attributes['PurchaseOrderLines']) || $this->attributes['PurchaseOrderLines'] == null) {
127 127
             $this->attributes['PurchaseOrderLines'] = [];
128 128
         }
129
-        if (!isset($array['LineNumber'])) {
129
+        if ( ! isset($array['LineNumber'])) {
130 130
             $array['LineNumber'] = count($this->attributes['PurchaseOrderLines']) + 1;
131 131
         }
132 132
         $this->attributes['PurchaseOrderLines'][] = $array;
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/SalesOrder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -141,10 +141,10 @@
 block discarded – undo
141 141
      */
142 142
     public function addItem(array $array)
143 143
     {
144
-        if (!isset($this->attributes['SalesOrderLines']) || $this->attributes['SalesOrderLines'] == null) {
144
+        if ( ! isset($this->attributes['SalesOrderLines']) || $this->attributes['SalesOrderLines'] == null) {
145 145
             $this->attributes['SalesOrderLines'] = [];
146 146
         }
147
-        if (!isset($array['LineNumber'])) {
147
+        if ( ! isset($array['LineNumber'])) {
148 148
             $array['LineNumber'] = count($this->attributes['SalesOrderLines']) + 1;
149 149
         }
150 150
         $this->attributes['SalesOrderLines'][] = $array;
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/InvoiceSalesOrders.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,4 +5,4 @@
 block discarded – undo
5 5
 /*
6 6
  * Added deprecated InvoiceSalesOrder class for backward compatibility
7 7
  */
8
-class_alias(__NAMESPACE__.'\InvoiceSalesOrder', __NAMESPACE__.'\InvoiceSalesOrders');
8
+class_alias(__NAMESPACE__ . '\InvoiceSalesOrder', __NAMESPACE__ . '\InvoiceSalesOrders');
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/Connection.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
         }
175 175
 
176 176
         // If we have a token, sign the request
177
-        if (!$this->needsAuthentication() && !empty($this->accessToken)) {
178
-            $headers['Authorization'] = 'Bearer '.$this->accessToken;
177
+        if ( ! $this->needsAuthentication() && ! empty($this->accessToken)) {
178
+            $headers['Authorization'] = 'Bearer ' . $this->accessToken;
179 179
         }
180 180
 
181 181
         // Create param string
182
-        if (!empty($params)) {
183
-            $endpoint .= '?'.http_build_query($params);
182
+        if ( ! empty($params)) {
183
+            $endpoint .= '?' . http_build_query($params);
184 184
         }
185 185
 
186 186
         // Create the request
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      */
283 283
     public function getAuthUrl()
284 284
     {
285
-        return $this->baseUrl.$this->authUrl.'?'.http_build_query([
285
+        return $this->baseUrl . $this->authUrl . '?' . http_build_query([
286 286
             'client_id'     => $this->exactClientId,
287 287
             'redirect_uri'  => $this->redirectUrl,
288 288
             'response_type' => 'code',
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     public function redirectForAuthorization()
333 333
     {
334 334
         $authUrl = $this->getAuthUrl();
335
-        header('Location: '.$authUrl);
335
+        header('Location: ' . $authUrl);
336 336
         exit;
337 337
     }
338 338
 
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
                     call_user_func($this->tokenUpdateCallback, $this);
466 466
                 }
467 467
             } else {
468
-                throw new ApiException('Could not acquire tokens, json decode failed. Got response: '.$response->getBody()->getContents());
468
+                throw new ApiException('Could not acquire tokens, json decode failed. Got response: ' . $response->getBody()->getContents());
469 469
             }
470 470
         } catch (BadResponseException $ex) {
471
-            throw new ApiException('Could not acquire or refresh tokens [http '.$ex->getResponse()->getStatusCode().']', 0, $ex);
471
+            throw new ApiException('Could not acquire or refresh tokens [http ' . $ex->getResponse()->getStatusCode() . ']', 0, $ex);
472 472
         } finally {
473 473
             if (is_callable($this->acquireAccessTokenUnlockCallback)) {
474 474
                 call_user_func($this->acquireAccessTokenUnlockCallback, $this);
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
      */
486 486
     private function getTimestampFromExpiresIn($expiresIn)
487 487
     {
488
-        if (!ctype_digit($expiresIn)) {
488
+        if ( ! ctype_digit($expiresIn)) {
489 489
             throw new \InvalidArgumentException('Function requires a numeric expires value');
490 490
         }
491 491
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
      */
587 587
     private function parseExceptionForErrorMessages(Exception $e)
588 588
     {
589
-        if (!$e instanceof BadResponseException) {
589
+        if ( ! $e instanceof BadResponseException) {
590 590
             throw new ApiException($e->getMessage());
591 591
         }
592 592
 
@@ -595,13 +595,13 @@  discard block
 block discarded – undo
595 595
         $responseBody = $response->getBody()->getContents();
596 596
         $decodedResponseBody = json_decode($responseBody, true);
597 597
 
598
-        if (!is_null($decodedResponseBody) && isset($decodedResponseBody['error']['message']['value'])) {
598
+        if ( ! is_null($decodedResponseBody) && isset($decodedResponseBody['error']['message']['value'])) {
599 599
             $errorMessage = $decodedResponseBody['error']['message']['value'];
600 600
         } else {
601 601
             $errorMessage = $responseBody;
602 602
         }
603 603
 
604
-        throw new ApiException('Error '.$response->getStatusCode().': '.$errorMessage);
604
+        throw new ApiException('Error ' . $response->getStatusCode() . ': ' . $errorMessage);
605 605
     }
606 606
 
607 607
     /**
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
      */
618 618
     private function getApiUrl()
619 619
     {
620
-        return $this->baseUrl.$this->apiUrl;
620
+        return $this->baseUrl . $this->apiUrl;
621 621
     }
622 622
 
623 623
     /**
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
      */
626 626
     private function getTokenUrl()
627 627
     {
628
-        return $this->baseUrl.$this->tokenUrl;
628
+        return $this->baseUrl . $this->tokenUrl;
629 629
     }
630 630
 
631 631
     /**
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/BankEntry.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 
59 59
     public function addItem(array $array)
60 60
     {
61
-        if (!isset($this->attributes['BankEntryLines']) || $this->attributes['BankEntryLines'] == null) {
61
+        if ( ! isset($this->attributes['BankEntryLines']) || $this->attributes['BankEntryLines'] == null) {
62 62
             $this->attributes['BankEntryLines'] = [];
63 63
         }
64 64
         $this->attributes['BankEntryLines'][] = $array;
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/Query/Findable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function find($id)
27 27
     {
28
-        $filter = $this->primaryKey()." eq guid'$id'";
28
+        $filter = $this->primaryKey() . " eq guid'$id'";
29 29
 
30 30
         if ($this->primaryKey() === 'Code') {
31
-            $filter = $this->primaryKey()." eq $id";
31
+            $filter = $this->primaryKey() . " eq $id";
32 32
         }
33 33
 
34 34
         $records = $this->connection()->get($this->url(), [
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     {
46 46
         //eg: $oAccounts->findWithSelect('5b7f4515-b7a0-4839-ac69-574968677d96', 'Code, Name');
47 47
         $result = $this->connection()->get($this->url(), [
48
-            '$filter' => $this->primaryKey()." eq guid'$id'",
48
+            '$filter' => $this->primaryKey() . " eq guid'$id'",
49 49
             '$select' => $select,
50 50
         ]);
51 51
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
         $result = $this->connection()->get($this->url(), $request, $headers);
110 110
 
111
-        if (!empty($divisionId)) {
111
+        if ( ! empty($divisionId)) {
112 112
             $this->connection()->setDivision($originalDivision); // Restore division
113 113
         }
114 114
 
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/DocumentAttachment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,6 +36,6 @@
 block discarded – undo
36 36
      */
37 37
     public function getDownloadUrl()
38 38
     {
39
-        return $this->Url.'&Download=1';
39
+        return $this->Url . '&Download=1';
40 40
     }
41 41
 }
Please login to merge, or discard this patch.