Passed
Branch master (f1682e)
by Stephan
02:21
created
src/Picqer/Financials/Exact/Model.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @var array The model's attributes
20 20
      */
21
-    protected $attributes = [ ];
21
+    protected $attributes = [];
22 22
     
23 23
     /**
24 24
      * @deferred array The model's collection values
25 25
      */
26
-    protected $deferred = [ ];
26
+    protected $deferred = [];
27 27
 
28 28
     /**
29 29
      * @var array The model's fillable attributes
30 30
      */
31
-    protected $fillable = [ ];
31
+    protected $fillable = [];
32 32
 
33 33
     /**
34 34
      * @var string The URL endpoint of this model
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     protected $primaryKey = 'ID';
42 42
 
43 43
 
44
-    public function __construct(Connection $connection, array $attributes = [ ])
44
+    public function __construct(Connection $connection, array $attributes = [])
45 45
     {
46 46
         $this->connection = $connection;
47 47
         $this->fill($attributes);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         }
136 136
 
137 137
         try {
138
-            if(is_array($this->attributes[$key]) && array_key_exists('__deferred', $this->attributes[$key])) {
138
+            if (is_array($this->attributes[$key]) && array_key_exists('__deferred', $this->attributes[$key])) {
139 139
                 $class = preg_replace('/(.+?)s?$/', __NAMESPACE__ . '\\\$1', $key); // Filter plural 's' and add namespace
140 140
                 $deferred = new $class($this->connection());
141 141
                 $uri = $this->attributes[$key]['__deferred']['uri'];
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             return $this->deferred[$key];
160 160
         }
161 161
         
162
-        if (isset( $this->attributes[$key] )) {
162
+        if (isset($this->attributes[$key])) {
163 163
             return $this->attributes[$key];
164 164
         }
165 165
     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             return false;
198 198
         }
199 199
 
200
-        return ! empty( $this->attributes[$this->primaryKey] );
200
+        return ! empty($this->attributes[$this->primaryKey]);
201 201
     }
202 202
 
203 203
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     {
213 213
         $attributes = $this->attributes;
214 214
         if ($withDeferred) {
215
-            foreach($this->deferred as $attribute => $collection) {
215
+            foreach ($this->deferred as $attribute => $collection) {
216 216
                 if (empty($collection)) {
217 217
                     continue; // Leave orriginal array with __deferred key
218 218
                 }
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
      *
252 252
      * @return boolean
253 253
      */
254
-    public function userHasRights($action='GET')
254
+    public function userHasRights($action = 'GET')
255 255
     {
256
-        $action =  preg_match('/^GET|POST|PUT|DELETE$/i', $action) ? strtoupper($action) : 'GET';
256
+        $action = preg_match('/^GET|POST|PUT|DELETE$/i', $action) ? strtoupper($action) : 'GET';
257 257
         $result = $this->connection()->get('users/UserHasRights', [
258 258
             'endpoint' => "'{$this->url}'",
259 259
             'action' => "'{$action}'"
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -145,8 +145,7 @@
 block discarded – undo
145 145
 
146 146
                 return true;
147 147
             }
148
-        }
149
-        catch (Exception $e) {
148
+        } catch (Exception $e) {
150 149
             // We tried lets leave it as is.
151 150
         }
152 151
 
Please login to merge, or discard this patch.
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.
src/Picqer/Financials/Exact/GeneralJournalEntry.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/Connection.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,8 +93,8 @@
 block discarded – undo
93 93
 
94 94
 
95 95
     /**
96
-    * @var
97
-    */
96
+     * @var
97
+     */
98 98
     public $nextUrl = null;
99 99
 
100 100
     /**
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
         }
166 166
 
167 167
         // If we have a token, sign the request
168
-        if (!$this->needsAuthentication() && !empty($this->accessToken)) {
168
+        if ( ! $this->needsAuthentication() && ! empty($this->accessToken)) {
169 169
             $headers['Authorization'] = 'Bearer ' . $this->accessToken;
170 170
         }
171 171
 
172 172
         // Create param string
173
-        if (!empty($params)) {
173
+        if ( ! empty($params)) {
174 174
             $endpoint .= '?' . http_build_query($params);
175 175
         }
176 176
 
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 
459 459
     private function getDateTimeFromExpires($expires)
460 460
     {
461
-        if (!is_numeric($expires)) {
461
+        if ( ! is_numeric($expires)) {
462 462
             throw new \InvalidArgumentException('Function requires a numeric expires value');
463 463
         }
464 464
 
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
      */
544 544
     private function parseExceptionForErrorMessages(Exception $e)
545 545
     {
546
-        if (! $e instanceof BadResponseException) {
546
+        if ( ! $e instanceof BadResponseException) {
547 547
             throw new ApiException($e->getMessage());
548 548
         }
549 549
 
@@ -552,13 +552,13 @@  discard block
 block discarded – undo
552 552
         $responseBody = $response->getBody()->getContents();
553 553
         $decodedResponseBody = json_decode($responseBody, true);
554 554
 
555
-        if (! is_null($decodedResponseBody) && isset($decodedResponseBody['error']['message']['value'])) {
555
+        if ( ! is_null($decodedResponseBody) && isset($decodedResponseBody['error']['message']['value'])) {
556 556
             $errorMessage = $decodedResponseBody['error']['message']['value'];
557 557
         } else {
558 558
             $errorMessage = $responseBody;
559 559
         }
560 560
 
561
-        throw new ApiException('Error ' . $response->getStatusCode() .': ' . $errorMessage);
561
+        throw new ApiException('Error ' . $response->getStatusCode() . ': ' . $errorMessage);
562 562
     }
563 563
 
564 564
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -358,8 +358,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/BankEntry.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
     protected $primaryKey = 'EntryID';
37 37
 
38
-    protected $bankEntryLines = [ ];
38
+    protected $bankEntryLines = [];
39 39
 
40 40
     protected $fillable = [
41 41
         'EntryID',
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
     public function addItem(array $array)
62 62
     {
63
-        if ( ! isset( $this->attributes['BankEntryLines'] ) || $this->attributes['BankEntryLines'] == null) {
64
-            $this->attributes['BankEntryLines'] = [ ];
63
+        if ( ! isset($this->attributes['BankEntryLines']) || $this->attributes['BankEntryLines'] == null) {
64
+            $this->attributes['BankEntryLines'] = [];
65 65
         }
66 66
         $this->attributes['BankEntryLines'][] = $array;
67 67
     }
Please login to merge, or discard this patch.
src/Picqer/Financials/Exact/PurchaseOrder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
     protected $primaryKey = 'PurchaseOrderID';
65 65
 
66
-    protected $purchaseOrderLines = [ ];
66
+    protected $purchaseOrderLines = [];
67 67
 
68 68
     protected $fillable = [
69 69
         'PurchaseOrderID',
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function addItem(array $array)
124 124
     {
125
-        if (!isset($this->attributes['PurchaseOrderLines']) || $this->attributes['PurchaseOrderLines'] == null) {
125
+        if ( ! isset($this->attributes['PurchaseOrderLines']) || $this->attributes['PurchaseOrderLines'] == null) {
126 126
             $this->attributes['PurchaseOrderLines'] = [];
127 127
         }
128
-        if (!isset($array['LineNumber'])) {
128
+        if ( ! isset($array['LineNumber'])) {
129 129
             $array['LineNumber'] = count($this->attributes['PurchaseOrderLines']) + 1;
130 130
         }
131 131
         $this->attributes['PurchaseOrderLines'][] = $array;
Please login to merge, or discard this patch.