@@ -119,7 +119,7 @@ |
||
119 | 119 | case MonetaryAccountBank::class: |
120 | 120 | case MonetaryAccountSavings::class: |
121 | 121 | case MonetaryAccountJoint::class: |
122 | - $return = [ |
|
122 | + $return = [ |
|
123 | 123 | 'id' => $object->getId(), |
124 | 124 | 'currency' => $object->getCurrency(), |
125 | 125 | 'description' => $object->getDescription(), |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | } |
95 | 95 | $totalCount = 0; |
96 | 96 | foreach (array_keys($this->configuration->getAccounts()) as $bunqAccountId) { |
97 | - $bunqAccountId = (int) $bunqAccountId; |
|
97 | + $bunqAccountId = (int)$bunqAccountId; |
|
98 | 98 | try { |
99 | 99 | $return[$bunqAccountId] = $this->getForAccount($bunqAccountId); |
100 | - $totalCount += count($return[$bunqAccountId]); |
|
100 | + $totalCount += count($return[$bunqAccountId]); |
|
101 | 101 | } catch (ImportException $e) { |
102 | 102 | app('log')->error($e->getMessage()); |
103 | 103 | app('log')->error($e->getTraceAsString()); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $disk = Storage::disk('downloads'); |
129 | 129 | try { |
130 | - $content = (string) $disk->get($this->downloadIdentifier); |
|
130 | + $content = (string)$disk->get($this->downloadIdentifier); |
|
131 | 131 | } catch (FileNotFoundException $e) { |
132 | 132 | app('log')->error('Could not store download'); |
133 | 133 | app('log')->error($e->getMessage()); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | return null; |
258 | 258 | } |
259 | 259 | |
260 | - $transaction = [ |
|
260 | + $transaction = [ |
|
261 | 261 | // TODO country, bunqMe, isLight, swiftBic, swiftAccountNumber, transferwiseAccountNumber, transferwiseBankCode |
262 | 262 | // TODO merchantCategoryCode, bunqtoStatus, bunqtoSubStatus, bunqtoExpiry, bunqtoTimeResponded |
263 | 263 | // TODO merchantReference, batchId, scheduledId, addressShipping, addressBilling, geolocation, allowChat, |
@@ -145,9 +145,9 @@ |
||
145 | 145 | $doImport = $array['do_import'] ?? []; |
146 | 146 | $accounts = []; |
147 | 147 | foreach ($doImport as $bunqId => $selected) { |
148 | - $selected = (int) $selected; |
|
148 | + $selected = (int)$selected; |
|
149 | 149 | if (1 === $selected) { |
150 | - $accounts[(int) $bunqId] = (int) ($array['accounts'][$bunqId] ?? 0); |
|
150 | + $accounts[(int)$bunqId] = (int)($array['accounts'][$bunqId] ?? 0); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | $object->accounts = $accounts; |
@@ -46,7 +46,7 @@ |
||
46 | 46 | // account ID's in the right order |
47 | 47 | $low = min($transaction['source_id'], $transaction['destination_id']); |
48 | 48 | $high = max($transaction['source_id'], $transaction['destination_id']); |
49 | - $amount = (string) round($transaction['amount'], 2); |
|
49 | + $amount = (string)round($transaction['amount'], 2); |
|
50 | 50 | $datetime = substr($transaction['datetime'], 0, 19); // shave off the milli seconds. |
51 | 51 | $description = $transaction['description']; |
52 | 52 | $key = sprintf($format, $low, $high, $amount, $description, $datetime); |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function send(array $transactions): array |
52 | 52 | { |
53 | - $uri = (string) config('bunq.uri'); |
|
54 | - $token = (string) config('bunq.access_token'); |
|
53 | + $uri = (string)config('bunq.uri'); |
|
54 | + $token = (string)config('bunq.access_token'); |
|
55 | 55 | foreach ($transactions as $index => $transaction) { |
56 | 56 | app('log')->debug(sprintf('Trying to send transaction #%d', $index), $transaction); |
57 | 57 | $this->sendTransaction($uri, $token, $index, $transaction); |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | return []; |
110 | 110 | } |
111 | 111 | $groupId = $group->id; |
112 | - $uri = (string) config('bunq.uri'); |
|
113 | - $groupUri = (string) sprintf('%s/transactions/show/%d', $uri, $groupId); |
|
112 | + $uri = (string)config('bunq.uri'); |
|
113 | + $groupUri = (string)sprintf('%s/transactions/show/%d', $uri, $groupId); |
|
114 | 114 | |
115 | 115 | /** @var Transaction $tr */ |
116 | 116 | foreach ($group->transactions as $tr) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $index + 1, |
119 | 119 | sprintf( |
120 | 120 | 'Created transaction #%d: <a href="%s">%s</a> (%s %s)', $groupId, $groupUri, $tr->description, $tr->currencyCode, |
121 | - round((float) $tr->amount, 2) |
|
121 | + round((float)$tr->amount, 2) |
|
122 | 122 | ) |
123 | 123 | ); |
124 | 124 | } |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | { |
68 | 68 | Log::debug('Going to collect all target accounts from Firefly III.'); |
69 | 69 | // send account list request to Firefly III. |
70 | - $token = (string) config('bunq.access_token'); |
|
71 | - $uri = (string) config('bunq.uri'); |
|
70 | + $token = (string)config('bunq.access_token'); |
|
71 | + $uri = (string)config('bunq.uri'); |
|
72 | 72 | $request = new GetAccountsRequest($uri, $token); |
73 | 73 | /** @var GetAccountsResponse $result */ |
74 | 74 | $result = $request->get(); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | continue; |
82 | 82 | } |
83 | 83 | $iban = $entry->iban; |
84 | - if ('' === (string) $iban) { |
|
84 | + if ('' === (string)$iban) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | Log::debug(sprintf('Collected %s (%s) under ID #%d', $iban, $entry->type, $entry->id)); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $return = []; |
105 | 105 | /** @var array $entry */ |
106 | 106 | foreach ($bunq as $bunqAccountId => $entries) { |
107 | - $bunqAccountId = (int) $bunqAccountId; |
|
107 | + $bunqAccountId = (int)$bunqAccountId; |
|
108 | 108 | app('log')->debug(sprintf('Going to parse account #%d', $bunqAccountId)); |
109 | 109 | foreach ($entries as $entry) { |
110 | 110 | $return[] = $this->generateTransaction($bunqAccountId, $entry); |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | $return['transactions'][0]['amount'] = $entry['amount']; |
168 | 168 | |
169 | 169 | // destination is bunq |
170 | - $return['transactions'][0]['destination_id'] = (int) $this->accounts[$bunqAccountId]; |
|
170 | + $return['transactions'][0]['destination_id'] = (int)$this->accounts[$bunqAccountId]; |
|
171 | 171 | |
172 | 172 | // source is the other side: |
173 | 173 | $return['transactions'][0]['source_iban'] = $entry['counter_party']['iban']; |
174 | 174 | $return['transactions'][0]['source_name'] = $entry['counter_party']['display_name']; |
175 | 175 | |
176 | - $mappedId = $this->getMappedId($entry['counter_party']['display_name'], (string) $entry['counter_party']['iban']); |
|
176 | + $mappedId = $this->getMappedId($entry['counter_party']['display_name'], (string)$entry['counter_party']['iban']); |
|
177 | 177 | if (null !== $mappedId && 0 !== $mappedId) { |
178 | 178 | $mappedType = $this->getMappedType($mappedId); |
179 | 179 | $return['transactions'][0]['type'] = $this->getTransactionType($mappedType, 'asset'); |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | $return['transactions'][0]['amount'] = bcmul($entry['amount'], '-1'); |
203 | 203 | |
204 | 204 | // source is bunq: |
205 | - $return['transactions'][0]['source_id'] = (int) $this->accounts[$bunqAccountId]; |
|
205 | + $return['transactions'][0]['source_id'] = (int)$this->accounts[$bunqAccountId]; |
|
206 | 206 | |
207 | 207 | // dest is shop |
208 | 208 | $return['transactions'][0]['destination_iban'] = $entry['counter_party']['iban']; |
209 | 209 | $return['transactions'][0]['destination_name'] = $entry['counter_party']['display_name']; |
210 | 210 | |
211 | - $mappedId = $this->getMappedId($entry['counter_party']['display_name'], (string) $entry['counter_party']['iban']); |
|
211 | + $mappedId = $this->getMappedId($entry['counter_party']['display_name'], (string)$entry['counter_party']['iban']); |
|
212 | 212 | //Log::debug(sprintf('Mapped ID is %s', var_export($mappedId, true))); |
213 | 213 | if (null !== $mappedId && 0 !== $mappedId) { |
214 | 214 | $return['transactions'][0]['destination_id'] = $mappedId; |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | */ |
244 | 244 | private function getAccountType(int $accountId): string |
245 | 245 | { |
246 | - $uri = (string) config('bunq.uri'); |
|
247 | - $token = (string) config('bunq.access_token'); |
|
246 | + $uri = (string)config('bunq.uri'); |
|
247 | + $token = (string)config('bunq.access_token'); |
|
248 | 248 | app('log')->debug(sprintf('Going to download account #%d', $accountId)); |
249 | 249 | $request = new GetAccountRequest($uri, $token); |
250 | 250 | $request->setId($accountId); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $fullName = sprintf('%s (%s)', $name, $iban); |
271 | 271 | } |
272 | 272 | if (isset($this->configuration->getMapping()[$fullName])) { |
273 | - return (int) $this->configuration->getMapping()[$fullName]; |
|
273 | + return (int)$this->configuration->getMapping()[$fullName]; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | return null; |
@@ -37,8 +37,8 @@ |
||
37 | 37 | */ |
38 | 38 | private function haveAccess(): bool |
39 | 39 | { |
40 | - $uri = (string) config('bunq.uri'); |
|
41 | - $token = (string) config('bunq.access_token'); |
|
40 | + $uri = (string)config('bunq.uri'); |
|
41 | + $token = (string)config('bunq.access_token'); |
|
42 | 42 | $request = new SystemInformationRequest($uri, $token); |
43 | 43 | try { |
44 | 44 | $request->get(); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | return null; |
124 | 124 | } |
125 | 125 | |
126 | - return (float) $res; |
|
126 | + return (float)$res; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function integer(string $field): int |
137 | 137 | { |
138 | - return (int) $this->get($field); |
|
138 | + return (int)$this->get($field); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return null; |
155 | 155 | } |
156 | 156 | |
157 | - return (int) $string; |
|
157 | + return (int)$string; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | return null; |
171 | 171 | } |
172 | 172 | |
173 | - $value = (string) $this->get($field); |
|
173 | + $value = (string)$this->get($field); |
|
174 | 174 | if ('' === $value) { |
175 | 175 | return null; |
176 | 176 | } |
177 | 177 | |
178 | - return (int) $value; |
|
178 | + return (int)$value; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | return null; |
192 | 192 | } |
193 | 193 | |
194 | - return $this->cleanString((string) ($this->get($field) ?? '')); |
|
194 | + return $this->cleanString((string)($this->get($field) ?? '')); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function string(string $field): string |
205 | 205 | { |
206 | - return $this->cleanString((string) ($this->get($field) ?? '')); |
|
206 | + return $this->cleanString((string)($this->get($field) ?? '')); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | if (null === $this->get($field)) { |
255 | 255 | return null; |
256 | 256 | } |
257 | - $value = (string) $this->get($field); |
|
257 | + $value = (string)$this->get($field); |
|
258 | 258 | if (10 === strlen($value)) { |
259 | 259 | // probably a date format. |
260 | 260 | try { |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | private function cleanString(string $string): string |
290 | 290 | { |
291 | - $search = [ |
|
291 | + $search = [ |
|
292 | 292 | "\u{0001}", // start of heading |
293 | 293 | "\u{0002}", // start of text |
294 | 294 | "\u{0003}", // end of text |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | public function doValidate(): JsonResponse |
50 | 50 | { |
51 | 51 | $response = ['result' => 'OK', 'message' => null]; |
52 | - $token = (string) config('bunq.access_token'); |
|
53 | - $uri = (string) config('bunq.uri'); |
|
52 | + $token = (string)config('bunq.access_token'); |
|
53 | + $uri = (string)config('bunq.uri'); |
|
54 | 54 | app('log')->debug(sprintf('Going to try and access %s', $uri)); |
55 | 55 | $request = new SystemInformationRequest($uri, $token); |
56 | 56 | try { |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function index() |
94 | 94 | { |
95 | - $token = (string) config('bunq.access_token'); |
|
96 | - $uri = (string) config('bunq.uri'); |
|
95 | + $token = (string)config('bunq.access_token'); |
|
96 | + $uri = (string)config('bunq.uri'); |
|
97 | 97 | app('log')->debug(sprintf('Going to try and access %s', $uri)); |
98 | 98 | $request = new SystemInformationRequest($uri, $token); |
99 | 99 | $errorMessage = 'No error message.'; |