@@ -44,13 +44,13 @@ |
||
| 44 | 44 | $response = response($result); |
| 45 | 45 | $name = sprintf('import_config_%s.json', date('Y-m-d')); |
| 46 | 46 | $response->header('Content-disposition', 'attachment; filename=' . $name) |
| 47 | - ->header('Content-Type', 'application/json') |
|
| 48 | - ->header('Content-Description', 'File Transfer') |
|
| 49 | - ->header('Connection', 'Keep-Alive') |
|
| 50 | - ->header('Expires', '0') |
|
| 51 | - ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') |
|
| 52 | - ->header('Pragma', 'public') |
|
| 53 | - ->header('Content-Length', strlen($result)); |
|
| 47 | + ->header('Content-Type', 'application/json') |
|
| 48 | + ->header('Content-Description', 'File Transfer') |
|
| 49 | + ->header('Connection', 'Keep-Alive') |
|
| 50 | + ->header('Expires', '0') |
|
| 51 | + ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0') |
|
| 52 | + ->header('Pragma', 'public') |
|
| 53 | + ->header('Content-Length', strlen($result)); |
|
| 54 | 54 | |
| 55 | 55 | return $response; |
| 56 | 56 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected static function processTransactionDetails(array $row): array |
| 79 | 79 | { |
| 80 | - if(isset($row[9])) { |
|
| 80 | + if (isset($row[9])) { |
|
| 81 | 81 | $transactionDetails = $row[9]; |
| 82 | 82 | $row[11] = self::opposingAccountName($transactionDetails); |
| 83 | 83 | $row[12] = self::opposingAccountIban($transactionDetails); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | private static function convertStructuredDescriptionToProperFormat(string $description): string |
| 131 | 131 | { |
| 132 | 132 | preg_match('/^\*\*\*(\d{3}\/\d{4}\/\d{5})\*\*\*$/', $description, $matches); |
| 133 | - if(isset($matches[1])) { |
|
| 133 | + if (isset($matches[1])) { |
|
| 134 | 134 | return '+++' . $matches[1] . '+++'; |
| 135 | 135 | } |
| 136 | 136 | return $description; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | private static function parseInformationFromTransactionDetails(string $transactionDetails, string $regex): string |
| 146 | 146 | { |
| 147 | - if(isset($transactionDetails)) { |
|
| 147 | + if (isset($transactionDetails)) { |
|
| 148 | 148 | preg_match($regex, $transactionDetails, $matches); |
| 149 | 149 | if (isset($matches[1])) { |
| 150 | 150 | return trim($matches[1]); |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | Log::debug(sprintf('Date converter is going to work on "%s" using format "%s"', $string, $this->dateFormat)); |
| 109 | 109 | try { |
| 110 | 110 | $carbon = Carbon::createFromFormat($this->dateFormat, $string); |
| 111 | - } catch (InvalidArgumentException|Exception $e) { |
|
| 111 | + } catch (InvalidArgumentException | Exception $e) { |
|
| 112 | 112 | Log::error(sprintf('%s converting the date: %s', get_class($e), $e->getMessage())); |
| 113 | 113 | return Carbon::today()->format('Y-m-d'); |
| 114 | 114 | } |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | private function getOriginalValue(string $key, array $transaction): string |
| 143 | 143 | { |
| 144 | 144 | $parts = explode('.', $key); |
| 145 | - if(1 === count($parts)) { |
|
| 145 | + if (1 === count($parts)) { |
|
| 146 | 146 | return $transaction[$key] ?? '(not found)'; |
| 147 | 147 | } |
| 148 | 148 | if (3 !== count($parts)) { |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | throw new ImportException('Could not load the users currency preference.'); |
| 132 | 132 | } |
| 133 | 133 | $code = $response->getPreference()->data ?? 'EUR'; |
| 134 | - $currencyRequest = new GetCurrencyRequest($uri,$token); |
|
| 134 | + $currencyRequest = new GetCurrencyRequest($uri, $token); |
|
| 135 | 135 | $currencyRequest->setCode($code); |
| 136 | 136 | try { |
| 137 | 137 | /** @var GetCurrencyResponse $result */ |
@@ -35,8 +35,8 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | private function haveAccess(): bool |
| 37 | 37 | { |
| 38 | - $uri = (string)config('csv_importer.uri'); |
|
| 39 | - $token = (string)config('csv_importer.access_token'); |
|
| 38 | + $uri = (string)config('csv_importer.uri'); |
|
| 39 | + $token = (string)config('csv_importer.access_token'); |
|
| 40 | 40 | $request = new SystemInformationRequest($uri, $token); |
| 41 | 41 | try { |
| 42 | 42 | $request->get(); |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | case 'VZ': // Verzamelbetaling |
| 81 | 81 | case 'IC': // Incasso |
| 82 | 82 | case 'DV': // Divers |
| 83 | - $this->removeIBANIngDescription(); // Remove "IBAN:", because it is already at "Tegenrekening" |
|
| 84 | - $this->removeNameIngDescription(); // Remove "Naam:", because it is already at "Naam/ Omschrijving" |
|
| 85 | - $this->removeIngDescription(); // Remove "Omschrijving", but not the value from description |
|
| 83 | + $this->removeIBANIngDescription(); // Remove "IBAN:", because it is already at "Tegenrekening" |
|
| 84 | + $this->removeNameIngDescription(); // Remove "Naam:", because it is already at "Naam/ Omschrijving" |
|
| 85 | + $this->removeIngDescription(); // Remove "Omschrijving", but not the value from description |
|
| 86 | 86 | $this->moveValutadatumDescription(); // Move "Valutadatum" from description to new column |
| 87 | - $this->MoveSavingsAccount(); // Move savings account number and name |
|
| 87 | + $this->MoveSavingsAccount(); // Move savings account number and name |
|
| 88 | 88 | break; |
| 89 | 89 | case 'BA': // Betaalautomaat |
| 90 | 90 | $this->moveValutadatumDescription(); // Move "Valutadatum" from description to new column |
@@ -152,19 +152,19 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | if (preg_match('/(Naar|Van) (.*rekening) ([A-Za-z0-9]+)/', $this->row[8], $matches)) { // Search for saving acount at 'Mededelingen' column |
| 154 | 154 | $this->row[1] .= ' ' . $matches[2] . ' ' . $matches[3]; // Current name + Saving acount name + Acount number |
| 155 | - if ('' === (string) $this->row[3]) { // if Saving account number does not yet exists |
|
| 155 | + if ('' === (string)$this->row[3]) { // if Saving account number does not yet exists |
|
| 156 | 156 | $this->row[3] = $matches[3]; // Copy savings account number |
| 157 | 157 | } |
| 158 | 158 | $this->row[8] = preg_replace('/(Naar|Van) (.*rekening) ([A-Za-z0-9]+)/', '', $this->row[8]); // Remove the savings account content from description |
| 159 | 159 | } elseif (preg_match('/(Naar|Van) (.*rekening) ([A-Za-z0-9]+)/', $this->row[1], $matches)) { // Search for saving acount at 'Naam / Omschrijving' column |
| 160 | - $this->row[1] = $matches[2] . ' ' . $matches[3]; // Saving acount name + Acount number |
|
| 161 | - if ('' === (string) $this->row[3]) { // if Saving account number does not yet exists |
|
| 160 | + $this->row[1] = $matches[2] . ' ' . $matches[3]; // Saving acount name + Acount number |
|
| 161 | + if ('' === (string)$this->row[3]) { // if Saving account number does not yet exists |
|
| 162 | 162 | $this->row[3] = $matches[3]; // Copy savings account number |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // if Saving account number exists |
| 167 | - if (('' !== (string) $this->row[3]) && !preg_match('/[A-Za-z]/', $this->row[3])) { // if Saving account number has no characters |
|
| 167 | + if (('' !== (string)$this->row[3]) && !preg_match('/[A-Za-z]/', $this->row[3])) { // if Saving account number has no characters |
|
| 168 | 168 | $this->row[3] = sprintf('%010d', $this->row[3]); // Make the number 10 digits |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function __construct(Repository $config) |
| 57 | 57 | { |
| 58 | - $trustedProxies = (string) config('csv_importer.trusted_proxies'); |
|
| 58 | + $trustedProxies = (string)config('csv_importer.trusted_proxies'); |
|
| 59 | 59 | $this->proxies = explode(',', $trustedProxies); |
| 60 | 60 | if ('**' === $trustedProxies) { |
| 61 | 61 | $this->proxies = '**'; |
@@ -77,12 +77,12 @@ |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if (array_key_exists('amount_modifier', $transaction)) { |
| 80 | - $transaction['amount_modifier'] = (string) $transaction['amount_modifier']; |
|
| 80 | + $transaction['amount_modifier'] = (string)$transaction['amount_modifier']; |
|
| 81 | 81 | } |
| 82 | 82 | if (array_key_exists('foreign_amount', $transaction)) { |
| 83 | - $transaction['foreign_amount'] = (string) $transaction['foreign_amount']; |
|
| 83 | + $transaction['foreign_amount'] = (string)$transaction['foreign_amount']; |
|
| 84 | 84 | } |
| 85 | - $amount = (string) $amount; |
|
| 85 | + $amount = (string)$amount; |
|
| 86 | 86 | if ('' === $amount) { |
| 87 | 87 | Log::error('Amount is EMPTY. This will give problems further ahead.', $transaction); |
| 88 | 88 | |