@@ -81,12 +81,12 @@ discard block |
||
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 |
||
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 | } |
@@ -62,7 +62,7 @@ |
||
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'); |
@@ -97,7 +97,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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) { |
@@ -98,7 +98,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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)) { |