@@ -13,236 +13,236 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class MT940 |
| 15 | 15 | { |
| 16 | - const TARGET_ARRAY = 0; |
|
| 17 | - |
|
| 18 | - const CD_CREDIT = 'credit'; |
|
| 19 | - const CD_DEBIT = 'debit'; |
|
| 20 | - const CD_CREDIT_CANCELLATION = 'credit_cancellation'; |
|
| 21 | - const CD_DEBIT_CANCELLATION = 'debit_cancellation'; |
|
| 22 | - |
|
| 23 | - /** @var string */ |
|
| 24 | - protected $rawData; |
|
| 25 | - /** @var string */ |
|
| 26 | - protected $soaDate; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * MT940 constructor. |
|
| 30 | - * |
|
| 31 | - * @param string $rawData |
|
| 32 | - */ |
|
| 33 | - public function __construct($rawData) |
|
| 34 | - { |
|
| 35 | - $this->rawData = (string) $rawData; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * @param string $target |
|
| 40 | - * @return array |
|
| 41 | - * @throws MT940Exception |
|
| 42 | - */ |
|
| 43 | - public function parse($target) |
|
| 44 | - { |
|
| 45 | - switch ($target) { |
|
| 46 | - case static::TARGET_ARRAY: |
|
| 47 | - return $this->parseToArray(); |
|
| 48 | - break; |
|
| 49 | - default: |
|
| 50 | - throw new MT940Exception('Invalid parse type provided'); |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @return array |
|
| 56 | - * @throws MT940Exception |
|
| 57 | - */ |
|
| 58 | - protected function parseToArray() |
|
| 59 | - { |
|
| 60 | - // The divider can be either \r\n or @@ |
|
| 61 | - |
|
| 62 | - $divider = "(@@|\r\n)"; |
|
| 63 | - $result = array(); |
|
| 64 | - |
|
| 65 | - // split at every :20: ("Die Felder ":20:" bis ":28:" müssen vor jedem Zwischensaldo ausgegeben werden.") |
|
| 66 | - $statementBlocks = preg_split('/' . $divider . ':20:.*?' . $divider . '/', $this->rawData); |
|
| 67 | - |
|
| 68 | - foreach ($statementBlocks as $statementBlock) { |
|
| 69 | - $parts = preg_split('/' . $divider . ':/', $statementBlock); |
|
| 70 | - $statement = array(); |
|
| 71 | - $transactions = array(); |
|
| 72 | - $cnt = 0; |
|
| 73 | - for ($i = 0, $cnt = count($parts); $i < $cnt; $i++) { |
|
| 74 | - // handle start balance |
|
| 75 | - // 60F:C160401EUR1234,56 |
|
| 76 | - if (preg_match('/^60[FM]:/', $parts[$i])) { |
|
| 77 | - $parts[$i] = substr($parts[$i], 4); |
|
| 78 | - $this->soaDate = $this->getDate(substr($parts[$i], 1, 6)); |
|
| 79 | - |
|
| 80 | - $amount = str_replace(',', '.', substr($parts[$i], 10)); |
|
| 81 | - $statement['start_balance'] = array( |
|
| 82 | - 'amount' => $amount, |
|
| 83 | - 'credit_debit' => (substr($parts[$i], 0, 1) == 'C') ? static::CD_CREDIT : static::CD_DEBIT |
|
| 84 | - ); |
|
| 85 | - $statement['date'] = $this->soaDate; |
|
| 86 | - } elseif ( |
|
| 87 | - // found transaction |
|
| 88 | - // trx:61:1603310331DR637,39N033NONREF |
|
| 89 | - 0 === strpos($parts[$i], '61:') |
|
| 90 | - && isset($parts[$i + 1]) |
|
| 91 | - && 0 === strpos($parts[$i + 1], '86:') |
|
| 92 | - ) { |
|
| 93 | - $transaction = substr($parts[$i], 3); |
|
| 94 | - $description = substr($parts[$i + 1], 3); |
|
| 95 | - |
|
| 96 | - $currentTrx = array(); |
|
| 97 | - |
|
| 98 | - preg_match('/^\d{6}(\d{4})?(C|D|RC|RD)[A-Z]?([^N]+)N/', $transaction, $matches); |
|
| 99 | - |
|
| 100 | - switch ($matches[2]) { |
|
| 101 | - case 'C': |
|
| 102 | - $currentTrx['credit_debit'] = static::CD_CREDIT; |
|
| 103 | - break; |
|
| 104 | - case 'D': |
|
| 105 | - $currentTrx['credit_debit'] = static::CD_DEBIT; |
|
| 106 | - break; |
|
| 107 | - case 'RC': |
|
| 108 | - $currentTrx['credit_debit'] = static::CD_CREDIT_CANCELLATION; |
|
| 109 | - break; |
|
| 110 | - case 'RD': |
|
| 111 | - $currentTrx['credit_debit'] = static::CD_DEBIT_CANCELLATION; |
|
| 112 | - break; |
|
| 113 | - default: |
|
| 114 | - throw new MT940Exception('c/d/rc/rd mark not found in: ' . $transaction); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - $amount = $matches[3]; |
|
| 118 | - $amount = str_replace(',', '.', $amount); |
|
| 119 | - $currentTrx['amount'] = floatval($amount); |
|
| 120 | - |
|
| 121 | - $currentTrx['transaction_code'] = substr($description, 0, 3); |
|
| 122 | - |
|
| 123 | - $description = $this->parseDescription($description); |
|
| 124 | - $currentTrx['description'] = $description; |
|
| 125 | - |
|
| 126 | - // :61:1605110509D198,02NMSCNONREF |
|
| 127 | - // 16 = year |
|
| 128 | - // 0511 = valuta date |
|
| 129 | - // 0509 = booking date |
|
| 130 | - $year = substr($transaction, 0, 2); |
|
| 131 | - $valutaDate = $this->getDate($year . substr($transaction, 2, 4)); |
|
| 132 | - |
|
| 133 | - $bookingDate = substr($transaction, 6, 4); |
|
| 134 | - if (preg_match('/^\d{4}$/', $bookingDate)) { |
|
| 135 | - // if valuta date is earlier than booking date, then it must be in the new year. |
|
| 136 | - if (substr($transaction, 2, 2) == '12' && substr($transaction, 6, 2) == '01') { |
|
| 137 | - $year++; |
|
| 138 | - } elseif (substr($transaction, 2, 2) == '01' && substr($transaction, 6, 2) == '12') { |
|
| 139 | - $year--; |
|
| 140 | - } |
|
| 141 | - $bookingDate = $this->getDate($year . $bookingDate); |
|
| 142 | - } else { |
|
| 143 | - // if booking date not set in :61, then we have to take it from :60F |
|
| 144 | - $bookingDate = $this->soaDate; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - $currentTrx['booking_date'] = $bookingDate; |
|
| 148 | - $currentTrx['valuta_date'] = $valutaDate; |
|
| 149 | - |
|
| 150 | - $transactions[] = $currentTrx; |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - $statement['transactions'] = $transactions; |
|
| 154 | - if (count($transactions) > 0) { |
|
| 155 | - $result[] = $statement; |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - return $result; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * @param string $descr |
|
| 164 | - * @return array |
|
| 165 | - */ |
|
| 166 | - protected function parseDescription($descr) |
|
| 167 | - { |
|
| 168 | - $prepared = array(); |
|
| 169 | - $result = array(); |
|
| 170 | - |
|
| 171 | - // prefill with empty values |
|
| 172 | - for ($i = 0; $i <= 63; $i++) { |
|
| 173 | - $prepared[$i] = null; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - $descr = str_replace("\r\n", '', $descr); |
|
| 177 | - $descr = str_replace('? ', '?', $descr); |
|
| 178 | - preg_match_all('/\?[\r\n]*(\d{2})([^\?]+)/', $descr, $matches, PREG_SET_ORDER); |
|
| 179 | - |
|
| 180 | - $descriptionLines = array(); |
|
| 181 | - $description1 = ''; // Legacy, could be removed. |
|
| 182 | - $description2 = ''; // Legacy, could be removed. |
|
| 183 | - foreach ($matches as $m) { |
|
| 184 | - $index = (int) $m[1]; |
|
| 185 | - if ((20 <= $index && $index <= 29) || (60 <= $index && $index <= 63)) { |
|
| 186 | - if (20 <= $index && $index <= 29) { |
|
| 187 | - $description1 .= $m[2]; |
|
| 188 | - } else { |
|
| 189 | - $description2 .= $m[2]; |
|
| 190 | - } |
|
| 191 | - $m[2] = trim($m[2]); |
|
| 192 | - if (!empty($m[2])) { |
|
| 193 | - $descriptionLines[] = $m[2]; |
|
| 194 | - } |
|
| 195 | - } else { |
|
| 196 | - $prepared[$index] = $m[2]; |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - $description = array(); |
|
| 201 | - if (empty($descriptionLines) || strlen($descriptionLines[0]) < 5 || $descriptionLines[0][4] !== '+') { |
|
| 202 | - $description['SVWZ'] = implode('', $descriptionLines); |
|
| 203 | - } else { |
|
| 204 | - $lastType = null; |
|
| 205 | - foreach ($descriptionLines as $line) { |
|
| 206 | - if (strlen($line) > 5 && $line[4] === '+') { |
|
| 207 | - if ($lastType != null) { |
|
| 208 | - $description[$lastType] = trim($description[$lastType]); |
|
| 209 | - } |
|
| 210 | - $lastType = substr($line, 0, 4); |
|
| 211 | - $description[$lastType] = substr($line, 5); |
|
| 212 | - } else { |
|
| 213 | - $description[$lastType] .= $line; |
|
| 214 | - } |
|
| 215 | - if (strlen($line) < 27) { |
|
| 216 | - // Usually, lines are 27 characters long. In case characters are missing, then it's either the end |
|
| 217 | - // of the current type or spaces have been trimmed from the end. We want to collapse multiple spaces |
|
| 218 | - // into one and we don't want to leave trailing spaces behind. So add a single space here to make up |
|
| 219 | - // for possibly missing spaces, and if it's the end of the type, it will be trimmed off later. |
|
| 220 | - $description[$lastType] .= ' '; |
|
| 221 | - } |
|
| 222 | - } |
|
| 223 | - $description[$lastType] = trim($description[$lastType]); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - $result['description'] = $description; |
|
| 227 | - $result['booking_text'] = trim($prepared[0]); |
|
| 228 | - $result['primanoten_nr'] = trim($prepared[10]); |
|
| 229 | - $result['description_1'] = trim($description1); |
|
| 230 | - $result['bank_code'] = trim($prepared[30]); |
|
| 231 | - $result['account_number'] = trim($prepared[31]); |
|
| 232 | - $result['name'] = trim($prepared[32] . $prepared[33]); |
|
| 233 | - $result['text_key_addition'] = trim($prepared[34]); |
|
| 234 | - $result['description_2'] = trim($description2); |
|
| 235 | - return $result; |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * @param string $val |
|
| 240 | - * @return string |
|
| 241 | - */ |
|
| 242 | - protected function getDate($val) |
|
| 243 | - { |
|
| 244 | - $val = '20' . $val; |
|
| 245 | - preg_match('/(\d{4})(\d{2})(\d{2})/', $val, $m); |
|
| 246 | - return $m[1] . '-' . $m[2] . '-' . $m[3]; |
|
| 247 | - } |
|
| 16 | + const TARGET_ARRAY = 0; |
|
| 17 | + |
|
| 18 | + const CD_CREDIT = 'credit'; |
|
| 19 | + const CD_DEBIT = 'debit'; |
|
| 20 | + const CD_CREDIT_CANCELLATION = 'credit_cancellation'; |
|
| 21 | + const CD_DEBIT_CANCELLATION = 'debit_cancellation'; |
|
| 22 | + |
|
| 23 | + /** @var string */ |
|
| 24 | + protected $rawData; |
|
| 25 | + /** @var string */ |
|
| 26 | + protected $soaDate; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * MT940 constructor. |
|
| 30 | + * |
|
| 31 | + * @param string $rawData |
|
| 32 | + */ |
|
| 33 | + public function __construct($rawData) |
|
| 34 | + { |
|
| 35 | + $this->rawData = (string) $rawData; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @param string $target |
|
| 40 | + * @return array |
|
| 41 | + * @throws MT940Exception |
|
| 42 | + */ |
|
| 43 | + public function parse($target) |
|
| 44 | + { |
|
| 45 | + switch ($target) { |
|
| 46 | + case static::TARGET_ARRAY: |
|
| 47 | + return $this->parseToArray(); |
|
| 48 | + break; |
|
| 49 | + default: |
|
| 50 | + throw new MT940Exception('Invalid parse type provided'); |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @return array |
|
| 56 | + * @throws MT940Exception |
|
| 57 | + */ |
|
| 58 | + protected function parseToArray() |
|
| 59 | + { |
|
| 60 | + // The divider can be either \r\n or @@ |
|
| 61 | + |
|
| 62 | + $divider = "(@@|\r\n)"; |
|
| 63 | + $result = array(); |
|
| 64 | + |
|
| 65 | + // split at every :20: ("Die Felder ":20:" bis ":28:" müssen vor jedem Zwischensaldo ausgegeben werden.") |
|
| 66 | + $statementBlocks = preg_split('/' . $divider . ':20:.*?' . $divider . '/', $this->rawData); |
|
| 67 | + |
|
| 68 | + foreach ($statementBlocks as $statementBlock) { |
|
| 69 | + $parts = preg_split('/' . $divider . ':/', $statementBlock); |
|
| 70 | + $statement = array(); |
|
| 71 | + $transactions = array(); |
|
| 72 | + $cnt = 0; |
|
| 73 | + for ($i = 0, $cnt = count($parts); $i < $cnt; $i++) { |
|
| 74 | + // handle start balance |
|
| 75 | + // 60F:C160401EUR1234,56 |
|
| 76 | + if (preg_match('/^60[FM]:/', $parts[$i])) { |
|
| 77 | + $parts[$i] = substr($parts[$i], 4); |
|
| 78 | + $this->soaDate = $this->getDate(substr($parts[$i], 1, 6)); |
|
| 79 | + |
|
| 80 | + $amount = str_replace(',', '.', substr($parts[$i], 10)); |
|
| 81 | + $statement['start_balance'] = array( |
|
| 82 | + 'amount' => $amount, |
|
| 83 | + 'credit_debit' => (substr($parts[$i], 0, 1) == 'C') ? static::CD_CREDIT : static::CD_DEBIT |
|
| 84 | + ); |
|
| 85 | + $statement['date'] = $this->soaDate; |
|
| 86 | + } elseif ( |
|
| 87 | + // found transaction |
|
| 88 | + // trx:61:1603310331DR637,39N033NONREF |
|
| 89 | + 0 === strpos($parts[$i], '61:') |
|
| 90 | + && isset($parts[$i + 1]) |
|
| 91 | + && 0 === strpos($parts[$i + 1], '86:') |
|
| 92 | + ) { |
|
| 93 | + $transaction = substr($parts[$i], 3); |
|
| 94 | + $description = substr($parts[$i + 1], 3); |
|
| 95 | + |
|
| 96 | + $currentTrx = array(); |
|
| 97 | + |
|
| 98 | + preg_match('/^\d{6}(\d{4})?(C|D|RC|RD)[A-Z]?([^N]+)N/', $transaction, $matches); |
|
| 99 | + |
|
| 100 | + switch ($matches[2]) { |
|
| 101 | + case 'C': |
|
| 102 | + $currentTrx['credit_debit'] = static::CD_CREDIT; |
|
| 103 | + break; |
|
| 104 | + case 'D': |
|
| 105 | + $currentTrx['credit_debit'] = static::CD_DEBIT; |
|
| 106 | + break; |
|
| 107 | + case 'RC': |
|
| 108 | + $currentTrx['credit_debit'] = static::CD_CREDIT_CANCELLATION; |
|
| 109 | + break; |
|
| 110 | + case 'RD': |
|
| 111 | + $currentTrx['credit_debit'] = static::CD_DEBIT_CANCELLATION; |
|
| 112 | + break; |
|
| 113 | + default: |
|
| 114 | + throw new MT940Exception('c/d/rc/rd mark not found in: ' . $transaction); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + $amount = $matches[3]; |
|
| 118 | + $amount = str_replace(',', '.', $amount); |
|
| 119 | + $currentTrx['amount'] = floatval($amount); |
|
| 120 | + |
|
| 121 | + $currentTrx['transaction_code'] = substr($description, 0, 3); |
|
| 122 | + |
|
| 123 | + $description = $this->parseDescription($description); |
|
| 124 | + $currentTrx['description'] = $description; |
|
| 125 | + |
|
| 126 | + // :61:1605110509D198,02NMSCNONREF |
|
| 127 | + // 16 = year |
|
| 128 | + // 0511 = valuta date |
|
| 129 | + // 0509 = booking date |
|
| 130 | + $year = substr($transaction, 0, 2); |
|
| 131 | + $valutaDate = $this->getDate($year . substr($transaction, 2, 4)); |
|
| 132 | + |
|
| 133 | + $bookingDate = substr($transaction, 6, 4); |
|
| 134 | + if (preg_match('/^\d{4}$/', $bookingDate)) { |
|
| 135 | + // if valuta date is earlier than booking date, then it must be in the new year. |
|
| 136 | + if (substr($transaction, 2, 2) == '12' && substr($transaction, 6, 2) == '01') { |
|
| 137 | + $year++; |
|
| 138 | + } elseif (substr($transaction, 2, 2) == '01' && substr($transaction, 6, 2) == '12') { |
|
| 139 | + $year--; |
|
| 140 | + } |
|
| 141 | + $bookingDate = $this->getDate($year . $bookingDate); |
|
| 142 | + } else { |
|
| 143 | + // if booking date not set in :61, then we have to take it from :60F |
|
| 144 | + $bookingDate = $this->soaDate; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + $currentTrx['booking_date'] = $bookingDate; |
|
| 148 | + $currentTrx['valuta_date'] = $valutaDate; |
|
| 149 | + |
|
| 150 | + $transactions[] = $currentTrx; |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + $statement['transactions'] = $transactions; |
|
| 154 | + if (count($transactions) > 0) { |
|
| 155 | + $result[] = $statement; |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + return $result; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * @param string $descr |
|
| 164 | + * @return array |
|
| 165 | + */ |
|
| 166 | + protected function parseDescription($descr) |
|
| 167 | + { |
|
| 168 | + $prepared = array(); |
|
| 169 | + $result = array(); |
|
| 170 | + |
|
| 171 | + // prefill with empty values |
|
| 172 | + for ($i = 0; $i <= 63; $i++) { |
|
| 173 | + $prepared[$i] = null; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + $descr = str_replace("\r\n", '', $descr); |
|
| 177 | + $descr = str_replace('? ', '?', $descr); |
|
| 178 | + preg_match_all('/\?[\r\n]*(\d{2})([^\?]+)/', $descr, $matches, PREG_SET_ORDER); |
|
| 179 | + |
|
| 180 | + $descriptionLines = array(); |
|
| 181 | + $description1 = ''; // Legacy, could be removed. |
|
| 182 | + $description2 = ''; // Legacy, could be removed. |
|
| 183 | + foreach ($matches as $m) { |
|
| 184 | + $index = (int) $m[1]; |
|
| 185 | + if ((20 <= $index && $index <= 29) || (60 <= $index && $index <= 63)) { |
|
| 186 | + if (20 <= $index && $index <= 29) { |
|
| 187 | + $description1 .= $m[2]; |
|
| 188 | + } else { |
|
| 189 | + $description2 .= $m[2]; |
|
| 190 | + } |
|
| 191 | + $m[2] = trim($m[2]); |
|
| 192 | + if (!empty($m[2])) { |
|
| 193 | + $descriptionLines[] = $m[2]; |
|
| 194 | + } |
|
| 195 | + } else { |
|
| 196 | + $prepared[$index] = $m[2]; |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + $description = array(); |
|
| 201 | + if (empty($descriptionLines) || strlen($descriptionLines[0]) < 5 || $descriptionLines[0][4] !== '+') { |
|
| 202 | + $description['SVWZ'] = implode('', $descriptionLines); |
|
| 203 | + } else { |
|
| 204 | + $lastType = null; |
|
| 205 | + foreach ($descriptionLines as $line) { |
|
| 206 | + if (strlen($line) > 5 && $line[4] === '+') { |
|
| 207 | + if ($lastType != null) { |
|
| 208 | + $description[$lastType] = trim($description[$lastType]); |
|
| 209 | + } |
|
| 210 | + $lastType = substr($line, 0, 4); |
|
| 211 | + $description[$lastType] = substr($line, 5); |
|
| 212 | + } else { |
|
| 213 | + $description[$lastType] .= $line; |
|
| 214 | + } |
|
| 215 | + if (strlen($line) < 27) { |
|
| 216 | + // Usually, lines are 27 characters long. In case characters are missing, then it's either the end |
|
| 217 | + // of the current type or spaces have been trimmed from the end. We want to collapse multiple spaces |
|
| 218 | + // into one and we don't want to leave trailing spaces behind. So add a single space here to make up |
|
| 219 | + // for possibly missing spaces, and if it's the end of the type, it will be trimmed off later. |
|
| 220 | + $description[$lastType] .= ' '; |
|
| 221 | + } |
|
| 222 | + } |
|
| 223 | + $description[$lastType] = trim($description[$lastType]); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + $result['description'] = $description; |
|
| 227 | + $result['booking_text'] = trim($prepared[0]); |
|
| 228 | + $result['primanoten_nr'] = trim($prepared[10]); |
|
| 229 | + $result['description_1'] = trim($description1); |
|
| 230 | + $result['bank_code'] = trim($prepared[30]); |
|
| 231 | + $result['account_number'] = trim($prepared[31]); |
|
| 232 | + $result['name'] = trim($prepared[32] . $prepared[33]); |
|
| 233 | + $result['text_key_addition'] = trim($prepared[34]); |
|
| 234 | + $result['description_2'] = trim($description2); |
|
| 235 | + return $result; |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * @param string $val |
|
| 240 | + * @return string |
|
| 241 | + */ |
|
| 242 | + protected function getDate($val) |
|
| 243 | + { |
|
| 244 | + $val = '20' . $val; |
|
| 245 | + preg_match('/(\d{4})(\d{2})(\d{2})/', $val, $m); |
|
| 246 | + return $m[1] . '-' . $m[2] . '-' . $m[3]; |
|
| 247 | + } |
|
| 248 | 248 | } |
@@ -43,11 +43,11 @@ |
||
| 43 | 43 | public function parse($target) |
| 44 | 44 | { |
| 45 | 45 | switch ($target) { |
| 46 | - case static::TARGET_ARRAY: |
|
| 47 | - return $this->parseToArray(); |
|
| 48 | - break; |
|
| 49 | - default: |
|
| 50 | - throw new MT940Exception('Invalid parse type provided'); |
|
| 46 | + case static::TARGET_ARRAY: |
|
| 47 | + return $this->parseToArray(); |
|
| 48 | + break; |
|
| 49 | + default: |
|
| 50 | + throw new MT940Exception('Invalid parse type provided'); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |