@@ -184,7 +184,7 @@ |
||
| 184 | 184 | public function sortPaymentOrderArrayByAmount(array $payment_orders, bool $ascending = true): array |
| 185 | 185 | { |
| 186 | 186 | usort($payment_orders, function (PaymentOrder $a, PaymentOrder $b) { |
| 187 | - return $a->getAmount() <=> $b->getAmount(); |
|
| 187 | + return $a->getAmount() <=> $b->getAmount(); |
|
| 188 | 188 | }); |
| 189 | 189 | |
| 190 | 190 | if (!$ascending) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | //If no array object is existing yet, create the array |
| 79 | - if(!is_array($grouped[$bank_account])) { |
|
| 79 | + if (!is_array($grouped[$bank_account])) { |
|
| 80 | 80 | $grouped[$bank_account] = []; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | //Limit the sum amount of each group |
| 119 | 119 | $groups_exceeding_limit = $tmp; |
| 120 | 120 | $output = []; |
| 121 | - while(!empty($groups_exceeding_limit)) { |
|
| 121 | + while (!empty($groups_exceeding_limit)) { |
|
| 122 | 122 | foreach ($groups_exceeding_limit as $key => $group) { |
| 123 | 123 | /** @var PaymentOrder[] $group */ |
| 124 | 124 | //If the group does not exceed the limit, then remove it from the bad list and put it to output array |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $part = array_slice($group, 0, $n + 1); |
| 137 | 137 | if ($this->calculateSumAmountOfPaymentOrders($part) > $limit_max_amount) { |
| 138 | 138 | //If our group contains just a single element which exceed the limit, then throw an exception, as we can not split it further. |
| 139 | - if(count($part) === 1) { |
|
| 139 | + if (count($part) === 1) { |
|
| 140 | 140 | throw new SinglePaymentOrderExceedsLimit($part[0], $limit_max_amount); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | //Split group into our two subgroups of which at least one is below the limit |
| 149 | - $a = array_slice($group, 0 , $split_index); |
|
| 149 | + $a = array_slice($group, 0, $split_index); |
|
| 150 | 150 | $b = array_slice($group, $split_index); |
| 151 | 151 | |
| 152 | 152 | //Remove the old group from list and add the new split groups |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public function sortPaymentOrderArrayByAmount(array $payment_orders, bool $ascending = true): array |
| 185 | 185 | { |
| 186 | - usort($payment_orders, function (PaymentOrder $a, PaymentOrder $b) { |
|
| 186 | + usort($payment_orders, function(PaymentOrder $a, PaymentOrder $b) { |
|
| 187 | 187 | return $a->getAmount() <=> $b->getAmount(); |
| 188 | 188 | }); |
| 189 | 189 | |