Passed
Push — master ( 0547e9...d89604 )
by James
10:02 queued 11s
created
app/Http/Controllers/TokenController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
app/Console/Commands/Import.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
app/Console/Commands/AutoImport.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
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/CSV/Converter/Iban.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
74 74
             $checksum = 2;
75 75
         }
76 76
 
77
-        return 1 === (int) $checksum;
77
+        return 1 === (int)$checksum;
78 78
     }
79 79
 
80 80
     /**
Please login to merge, or discard this patch.
app/Services/Import/Task/Accounts.php 1 patch
Spacing   +14 added lines, -14 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,10 +381,10 @@  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
-        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
 
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/Routine/APISubmitter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)) {
Please login to merge, or discard this patch.