@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | $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']; |
| 59 | 59 | $replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', |
| 60 | - '32', '33', '34', '35',]; |
|
| 60 | + '32', '33', '34', '35', ]; |
|
| 61 | 61 | |
| 62 | 62 | // take |
| 63 | 63 | $first = substr($value, 0, 4); |
@@ -49,11 +49,11 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public static function getColumns(string $content, Configuration $configuration): array |
| 51 | 51 | { |
| 52 | - $reader = Reader::createFromString($content); |
|
| 52 | + $reader = Reader::createFromString($content); |
|
| 53 | 53 | |
| 54 | 54 | // configure reader: |
| 55 | 55 | $delimiter = $configuration->getDelimiter(); |
| 56 | - switch($delimiter) { |
|
| 56 | + switch ($delimiter) { |
|
| 57 | 57 | default: |
| 58 | 58 | case 'comma': |
| 59 | 59 | $reader->setDelimiter(','); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public static function getExampleData(string $content, Configuration $configuration): array |
| 122 | 122 | { |
| 123 | - $reader = Reader::createFromString($content); |
|
| 123 | + $reader = Reader::createFromString($content); |
|
| 124 | 124 | |
| 125 | 125 | // configure reader: |
| 126 | 126 | $delimiter = $configuration->getDelimiter(); |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | public function doValidate(): JsonResponse |
| 46 | 46 | { |
| 47 | 47 | $response = ['result' => 'OK', 'message' => null]; |
| 48 | - $uri = (string)config('csv_importer.uri'); |
|
| 49 | - $token = (string)config('csv_importer.access_token'); |
|
| 48 | + $uri = (string)config('csv_importer.uri'); |
|
| 49 | + $token = (string)config('csv_importer.access_token'); |
|
| 50 | 50 | $request = new SystemInformationRequest($uri, $token); |
| 51 | 51 | try { |
| 52 | 52 | $result = $request->get(); |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | // 0 = OK (same version) |
| 58 | 58 | // 1 = NOK (too low a version) |
| 59 | 59 | |
| 60 | - $minimum = (string) config('csv_importer.minimum_version'); |
|
| 60 | + $minimum = (string)config('csv_importer.minimum_version'); |
|
| 61 | 61 | $compare = version_compare($minimum, $result->version); |
| 62 | 62 | if (1 === $compare) { |
| 63 | 63 | $errorMessage = sprintf( |
| 64 | 64 | 'Your Firefly III version %s is below the minimum required version %s', |
| 65 | 65 | $result->version, $minimum |
| 66 | 66 | ); |
| 67 | - $response = ['result' => 'NOK', 'message' => $errorMessage]; |
|
| 67 | + $response = ['result' => 'NOK', 'message' => $errorMessage]; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return response()->json($response); |
@@ -68,8 +68,8 @@ |
||
| 68 | 68 | |
| 69 | 69 | $this->info(sprintf('Welcome to the Firefly III CSV importer, v%s', config('csv_importer.version'))); |
| 70 | 70 | Log::debug(sprintf('Now in %s', __METHOD__)); |
| 71 | - $file = (string) $this->argument('file'); |
|
| 72 | - $config = (string) $this->argument('config'); |
|
| 71 | + $file = (string)$this->argument('file'); |
|
| 72 | + $config = (string)$this->argument('config'); |
|
| 73 | 73 | if (!file_exists($file) || (file_exists($file) && !is_file($file))) { |
| 74 | 74 | $message = sprintf('The importer can\'t import: CSV file "%s" does not exist or could not be read.', $file); |
| 75 | 75 | $this->error($message); |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | return 1; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - $this->directory = (string) ($this->argument('directory') ?? './'); |
|
| 71 | + $this->directory = (string)($this->argument('directory') ?? './'); |
|
| 72 | 72 | $this->line(sprintf('Going to automatically import everything found in %s', $this->directory)); |
| 73 | 73 | |
| 74 | 74 | $files = $this->getFiles(); |
@@ -73,33 +73,33 @@ |
||
| 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 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function processTransaction(int $index, array $line): void |
| 103 | 103 | { |
| 104 | - $uri = (string) config('csv_importer.uri'); |
|
| 105 | - $token = (string) config('csv_importer.access_token'); |
|
| 104 | + $uri = (string)config('csv_importer.uri'); |
|
| 105 | + $token = (string)config('csv_importer.access_token'); |
|
| 106 | 106 | $request = new PostTransactionRequest($uri, $token); |
| 107 | 107 | Log::debug('Submitting to Firefly III:', $line); |
| 108 | 108 | $request->setBody($line); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | private function getOriginalValue(string $key, array $transaction): string |
| 161 | 161 | { |
| 162 | 162 | $parts = explode('.', $key); |
| 163 | - if(1 === count($parts)) { |
|
| 163 | + if (1 === count($parts)) { |
|
| 164 | 164 | return $transaction[$key] ?? '(not found)'; |
| 165 | 165 | } |
| 166 | 166 | if (3 !== count($parts)) { |