Passed
Pull Request — master (#7)
by
unknown
04:01 queued 18s
created
app/Services/Import/Task/Amount.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,33 +73,33 @@
 block discarded – undo
73 73
     {
74 74
         Log::debug(sprintf('Now at the start of processAmount("%s")', $transaction['amount']));
75 75
         $amount = null;
76
-        if (null === $amount && $this->validAmount((string) $transaction['amount'])) {
76
+        if (null === $amount && $this->validAmount((string)$transaction['amount'])) {
77 77
             Log::debug('Transaction["amount"] value is not NULL, assume this is the correct value.');
78 78
             $amount = $transaction['amount'];
79 79
         }
80 80
 
81
-        if (null === $amount && $this->validAmount((string) $transaction['amount_debit'])) {
81
+        if (null === $amount && $this->validAmount((string)$transaction['amount_debit'])) {
82 82
             Log::debug(sprintf('Transaction["amount_debit"] value is not NULL ("%s"), assume this is the correct value.', $transaction['amount_debit']));
83 83
             $amount = $transaction['amount_debit'];
84 84
         }
85 85
 
86
-        if (null === $amount && $this->validAmount((string) $transaction['amount_credit'])) {
86
+        if (null === $amount && $this->validAmount((string)$transaction['amount_credit'])) {
87 87
             Log::debug(sprintf('Transaction["amount_credit"] value is not NULL ("%s"), assume this is the correct value.', $transaction['amount_credit']));
88 88
             $amount = $transaction['amount_credit'];
89 89
         }
90 90
 
91
-        if (null === $amount && $this->validAmount((string) $transaction['amount_negated'])) {
91
+        if (null === $amount && $this->validAmount((string)$transaction['amount_negated'])) {
92 92
             Log::debug(sprintf('Transaction["amount_negated"] value is not NULL ("%s"), assume this is the correct value.', $transaction['amount_negated']));
93 93
             $amount = $transaction['amount_negated'];
94 94
         }
95 95
 
96 96
         if (array_key_exists('amount_modifier', $transaction)) {
97
-            $transaction['amount_modifier'] = (string) $transaction['amount_modifier'];
97
+            $transaction['amount_modifier'] = (string)$transaction['amount_modifier'];
98 98
         }
99 99
         if (array_key_exists('foreign_amount', $transaction)) {
100
-            $transaction['foreign_amount'] = (string) $transaction['foreign_amount'];
100
+            $transaction['foreign_amount'] = (string)$transaction['foreign_amount'];
101 101
         }
102
-        $amount = (string) $amount;
102
+        $amount = (string)$amount;
103 103
         if ('' === $amount) {
104 104
             Log::error('Amount is EMPTY. This will give problems further ahead.', $transaction);
105 105
 
Please login to merge, or discard this patch.
app/Mail/ImportFinished.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,8 +41,8 @@
 block discarded – undo
41 41
      */
42 42
     public function build()
43 43
     {
44
-        $address = (string) config('mail.from.address');
45
-        $name    = (string) config('mail.from.name');
44
+        $address = (string)config('mail.from.address');
45
+        $name    = (string)config('mail.from.name');
46 46
 
47 47
         return $this->from($address, $name)->markdown('emails.import.finished');
48 48
     }
Please login to merge, or discard this patch.
app/Services/Import/Task/EmptyAccounts.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -118,16 +118,16 @@
 block discarded – undo
118 118
 
119 119
         if ('withdrawal' === $transaction['type']) {
120 120
             $destName = $transaction['destination_name'] ?? '';
121
-            $destId   = (int) ($transaction['destination_id'] ?? 0);
121
+            $destId   = (int)($transaction['destination_id'] ?? 0);
122 122
             $destIban = $transaction['destination_iban'] ?? '';
123
-            if ('' === $destName && 0 === $destId && ''=== $destIban) {
123
+            if ('' === $destName && 0 === $destId && '' === $destIban) {
124 124
                 Log::debug('Destination name + ID + IBAN of withdrawal are empty, set to "(no name)".');
125 125
                 $transaction['destination_name'] = '(no name)';
126 126
             }
127 127
         }
128 128
         if ('deposit' === $transaction['type']) {
129 129
             $sourceName = $transaction['source_name'] ?? '';
130
-            $sourceId   = (int) ($transaction['source_id'] ?? 0);
130
+            $sourceId   = (int)($transaction['source_id'] ?? 0);
131 131
             $sourceIban = $transaction['source_iban'] ?? '';
132 132
             if ('' === $sourceName && 0 === $sourceId && '' === $sourceIban) {
133 133
                 Log::debug('Source name + IBAN + ID of deposit are empty, set to "(no name)".');
Please login to merge, or discard this patch.
app/Services/Import/ImportJobStatus/ImportJobStatusManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
                 try {
51 51
                     $array  = json_decode($disk->get($identifier), true, 512, JSON_THROW_ON_ERROR);
52 52
                     $status = ImportJobStatus::fromArray($array);
53
-                } catch (FileNotFoundException|JsonException $e) {
53
+                } catch (FileNotFoundException | JsonException $e) {
54 54
                     Log::error($e->getMessage());
55 55
                     $status = new ImportJobStatus;
56 56
                 }
Please login to merge, or discard this patch.
app/Services/CSV/Specifics/IngDescription.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
                 case 'VZ':                               // Verzamelbetaling
82 82
                 case 'IC':                               // Incasso
83 83
                 case 'DV':                               // Divers
84
-                    $this->removeIBANIngDescription();   // Remove "IBAN:", because it is already at "Tegenrekening"
85
-                    $this->removeNameIngDescription();   // Remove "Naam:", because it is already at "Naam/ Omschrijving"
86
-                    $this->removeIngDescription();       // Remove "Omschrijving", but not the value from description
84
+                    $this->removeIBANIngDescription(); // Remove "IBAN:", because it is already at "Tegenrekening"
85
+                    $this->removeNameIngDescription(); // Remove "Naam:", because it is already at "Naam/ Omschrijving"
86
+                    $this->removeIngDescription(); // Remove "Omschrijving", but not the value from description
87 87
                     $this->moveValutadatumDescription(); // Move "Valutadatum" from description to new column
88
-                    $this->MoveSavingsAccount();         // Move savings account number and name
89
-                    $this->moveDatumTijdValue();         // Move datum + tijd
88
+                    $this->MoveSavingsAccount(); // Move savings account number and name
89
+                    $this->moveDatumTijdValue(); // Move datum + tijd
90 90
                     break;
91 91
                 case 'BA':                              // Betaalautomaat
92 92
                     $this->moveValutadatumDescription(); // Move "Valutadatum" from description to new column
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
 
172 172
         if (preg_match('/(Naar|Van) (.*rekening) ([A-Za-z0-9]+)/', $this->row[8], $matches)) { // Search for saving acount at 'Mededelingen' column
173 173
             $this->row[1] .= ' ' . $matches[2] . ' ' . $matches[3]; // Current name + Saving acount name + Acount number
174
-            if ('' === (string) $this->row[3]) { // if Saving account number does not yet exists
174
+            if ('' === (string)$this->row[3]) { // if Saving account number does not yet exists
175 175
                 $this->row[3] = $matches[3]; // Copy savings account number
176 176
             }
177 177
             $this->row[8] = preg_replace('/(Naar|Van) (.*rekening) ([A-Za-z0-9]+)/', '', $this->row[8]); // Remove the savings account content from description
178 178
         } elseif (preg_match('/(Naar|Van) (.*rekening) ([A-Za-z0-9]+)/', $this->row[1], $matches)) { // Search for saving acount at 'Naam / Omschrijving' column
179
-            $this->row[1] = $matches[2] . ' ' . $matches[3];  // Saving acount name + Acount number
180
-            if ('' === (string) $this->row[3]) { // if Saving account number does not yet exists
179
+            $this->row[1] = $matches[2] . ' ' . $matches[3]; // Saving acount name + Acount number
180
+            if ('' === (string)$this->row[3]) { // if Saving account number does not yet exists
181 181
                 $this->row[3] = $matches[3]; // Copy savings account number
182 182
             }
183 183
         }
184 184
 
185 185
         // if Saving account number exists
186
-        if (('' !== (string) $this->row[3]) && !preg_match('/[A-Za-z]/', $this->row[3])) { // if Saving account number has no characters
186
+        if (('' !== (string)$this->row[3]) && !preg_match('/[A-Za-z]/', $this->row[3])) { // if Saving account number has no characters
187 187
             $this->row[3] = sprintf('%010d', $this->row[3]); // Make the number 10 digits
188 188
         }
189 189
     }
Please login to merge, or discard this patch.
app/Services/CSV/Converter/Date.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
             Log::debug(sprintf('Date converter is going to work on "%s" using format "%s"', $string, $this->dateFormat));
63 63
             try {
64 64
                 $carbon = Carbon::createFromFormat($this->dateFormat, $string);
65
-            } catch (InvalidArgumentException|Exception $e) {
65
+            } catch (InvalidArgumentException | Exception $e) {
66 66
                 Log::error(sprintf('%s converting the date: %s', get_class($e), $e->getMessage()));
67 67
 
68 68
                 return Carbon::today()->startOfDay()->format('Y-m-d H:i:s');
Please login to merge, or discard this patch.
app/Services/Import/Task/Accounts.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         // if the ID is set, at least search for the ID.
98 98
         if (is_int($array['id']) && $array['id'] > 0) {
99 99
             Log::debug('Find by ID field.');
100
-            $result = $this->findById((string) $array['id']);
100
+            $result = $this->findById((string)$array['id']);
101 101
         }
102 102
         if (null !== $result) {
103 103
             $return = $result->toArray();
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
         }
108 108
 
109 109
         // if the IBAN is set, search for the IBAN.
110
-        if (isset($array['iban']) && '' !== (string) $array['iban']) {
110
+        if (isset($array['iban']) && '' !== (string)$array['iban']) {
111 111
             Log::debug('Find by IBAN.');
112
-            $transactionType = (string) ($array['transaction_type'] ?? null);
113
-            $result          = $this->findByIban((string) $array['iban'], $transactionType);
112
+            $transactionType = (string)($array['transaction_type'] ?? null);
113
+            $result          = $this->findByIban((string)$array['iban'], $transactionType);
114 114
         }
115 115
         if (null !== $result) {
116 116
             $return = $result->toArray();
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
         }
121 121
 
122 122
         // find by name, return only if it's an asset or liability account.
123
-        if (isset($array['name']) && '' !== (string) $array['name']) {
123
+        if (isset($array['name']) && '' !== (string)$array['name']) {
124 124
             Log::debug('Find by name.');
125
-            $result = $this->findByName((string) $array['name']);
125
+            $result = $this->findByName((string)$array['name']);
126 126
         }
127 127
         if (null !== $result) {
128 128
             $return = $result->toArray();
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
     private function findById(string $value): ?Account
200 200
     {
201 201
         Log::debug(sprintf('Going to search account with ID "%s"', $value));
202
-        $uri     = (string) config('csv_importer.uri');
203
-        $token   = (string) config('csv_importer.access_token');
202
+        $uri     = (string)config('csv_importer.uri');
203
+        $token   = (string)config('csv_importer.access_token');
204 204
         $request = new GetSearchAccountRequest($uri, $token);
205 205
         $request->setField('id');
206 206
         $request->setQuery($value);
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
     private function findByIban(string $iban, string $transactionType): ?Account
240 240
     {
241 241
         Log::debug(sprintf('Going to search account with IBAN "%s"', $iban));
242
-        $uri     = (string) config('csv_importer.uri');
243
-        $token   = (string) config('csv_importer.access_token');
242
+        $uri     = (string)config('csv_importer.uri');
243
+        $token   = (string)config('csv_importer.access_token');
244 244
         $request = new GetSearchAccountRequest($uri, $token);
245 245
         $request->setField('iban');
246 246
         $request->setQuery($iban);
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
     private function findByName(string $name): ?Account
286 286
     {
287 287
         Log::debug(sprintf('Going to search account with name "%s"', $name));
288
-        $uri     = (string) config('csv_importer.uri');
289
-        $token   = (string) config('csv_importer.access_token');
288
+        $uri     = (string)config('csv_importer.uri');
289
+        $token   = (string)config('csv_importer.access_token');
290 290
         $request = new GetSearchAccountRequest($uri, $token);
291 291
         $request->setField('name');
292 292
         $request->setQuery($name);
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         $transaction         = $this->setDestination($transaction, $destination);
382 382
         $transaction['type'] = $this->determineType($source['type'], $destination['type']);
383 383
 
384
-        $amount = (string) $transaction['amount'];
384
+        $amount = (string)$transaction['amount'];
385 385
         $amount = '' === $amount ? '0' : $amount;
386 386
 
387 387
         if ('0' === $amount) {
Please login to merge, or discard this patch.
app/Services/Import/Routine/APISubmitter.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             return;
99 99
         }
100 100
 
101
-        $groupId = (int) $groupInfo['group_id'];
101
+        $groupId = (int)$groupInfo['group_id'];
102 102
         Log::debug(sprintf('Going to add import tag to transaction group #%d', $groupId));
103 103
         $body = [
104 104
             'transactions' => [],
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
                 'tags'                   => $currentTags,
115 115
             ];
116 116
         }
117
-        $uri     = (string) config('csv_importer.uri');
118
-        $token   = (string) config('csv_importer.access_token');
117
+        $uri     = (string)config('csv_importer.uri');
118
+        $token   = (string)config('csv_importer.access_token');
119 119
         $request = new PutTransactionRequest($uri, $token, $groupId);
120 120
         $request->setBody($body);
121 121
         $request->put();
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 
169 169
             return;
170 170
         }
171
-        $uri     = (string) config('csv_importer.uri');
172
-        $token   = (string) config('csv_importer.access_token');
171
+        $uri     = (string)config('csv_importer.uri');
172
+        $token   = (string)config('csv_importer.access_token');
173 173
         $request = new PostTagRequest($uri, $token);
174 174
         $body    = [
175 175
             'tag'  => $this->tag,
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
     private function processTransaction(int $index, array $line): array
205 205
     {
206 206
         $return = [];
207
-        $uri      = (string) config('csv_importer.uri');
208
-        $token    = (string) config('csv_importer.access_token');
207
+        $uri      = (string)config('csv_importer.uri');
208
+        $token    = (string)config('csv_importer.access_token');
209 209
         $request  = new PostTransactionRequest($uri, $token);
210 210
         Log::debug('Submitting to Firefly III:', $line);
211 211
         $request->setBody($line);
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     private function getOriginalValue(string $key, array $transaction): string
282 282
     {
283 283
         $parts = explode('.', $key);
284
-        if(1 === count($parts)) {
284
+        if (1 === count($parts)) {
285 285
             return $transaction[$key] ?? '(not found)';
286 286
         }
287 287
         if (3 !== count($parts)) {
Please login to merge, or discard this patch.
app/Services/CSV/Converter/Iban.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         Log::debug(sprintf('Trim: isValidIBAN("%s")', $value));
68 68
         $search  = [' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
69 69
         $replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31',
70
-                    '32', '33', '34', '35',];
70
+                    '32', '33', '34', '35', ];
71 71
         // take
72 72
         $first = substr($value, 0, 4);
73 73
         $last  = substr($value, 4);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             $checksum = 2;
81 81
         }
82 82
 
83
-        return 1 === (int) $checksum;
83
+        return 1 === (int)$checksum;
84 84
     }
85 85
 
86 86
     /**
Please login to merge, or discard this patch.