@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $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']; |
| 62 | 62 | $replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', |
| 63 | - '32', '33', '34', '35',]; |
|
| 63 | + '32', '33', '34', '35', ]; |
|
| 64 | 64 | |
| 65 | 65 | // take |
| 66 | 66 | $first = substr($value, 0, 4); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $checksum = 2; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - return 1 === (int) $checksum; |
|
| 77 | + return 1 === (int)$checksum; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -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,10 +381,10 @@ 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 | - if('0'===$amount) { |
|
| 387 | + if ('0' === $amount) { |
|
| 388 | 388 | Log::error('Amount is ZERO. This will give trouble further down the line.'); |
| 389 | 389 | } |
| 390 | 390 | |
@@ -118,16 +118,16 @@ |
||
| 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)".'); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $groupId = (int) $groupInfo['group_id']; |
|
| 91 | + $groupId = (int)$groupInfo['group_id']; |
|
| 92 | 92 | Log::debug(sprintf('Going to add import tag to transaction group #%d', $groupId)); |
| 93 | 93 | $body = [ |
| 94 | 94 | 'transactions' => [], |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | 'tags' => $currentTags, |
| 105 | 105 | ]; |
| 106 | 106 | } |
| 107 | - $uri = (string) config('csv_importer.uri'); |
|
| 108 | - $token = (string) config('csv_importer.access_token'); |
|
| 107 | + $uri = (string)config('csv_importer.uri'); |
|
| 108 | + $token = (string)config('csv_importer.access_token'); |
|
| 109 | 109 | $request = new PutTransactionRequest($uri, $token, $groupId); |
| 110 | 110 | $request->setBody($body); |
| 111 | 111 | $request->put(); |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | private function processTransaction(int $index, array $line): array |
| 161 | 161 | { |
| 162 | 162 | $response = []; |
| 163 | - $uri = (string) config('csv_importer.uri'); |
|
| 164 | - $token = (string) config('csv_importer.access_token'); |
|
| 163 | + $uri = (string)config('csv_importer.uri'); |
|
| 164 | + $token = (string)config('csv_importer.access_token'); |
|
| 165 | 165 | $request = new PostTransactionRequest($uri, $token); |
| 166 | 166 | Log::debug('Submitting to Firefly III:', $line); |
| 167 | 167 | $request->setBody($line); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | private function getOriginalValue(string $key, array $transaction): string |
| 238 | 238 | { |
| 239 | 239 | $parts = explode('.', $key); |
| 240 | - if(1 === count($parts)) { |
|
| 240 | + if (1 === count($parts)) { |
|
| 241 | 241 | return $transaction[$key] ?? '(not found)'; |
| 242 | 242 | } |
| 243 | 243 | if (3 !== count($parts)) { |
@@ -50,7 +50,7 @@ |
||
| 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 | } |