Code Duplication    Length = 6-6 lines in 5 locations

catalog/includes/modules/payment/sage_pay_direct.php 2 locations

@@ 499-504 (lines=6) @@
496
      $string_array = explode(chr(10), $transaction_response);
497
      $sage_pay_response = array();
498
499
      foreach ($string_array as $string) {
500
        if (strpos($string, '=') != false) {
501
          $parts = explode('=', $string, 2);
502
          $sage_pay_response[trim($parts[0])] = trim($parts[1]);
503
        }
504
      }
505
506
      if ( isset($params['CreateToken']) && ($params['CreateToken'] == '1') ) {
507
        $_SESSION['sagepay_token_cc_type'] = $params['CardType'];
@@ 1018-1023 (lines=6) @@
1015
      $string_array = explode(chr(10), $response);
1016
      $sage_pay_response = array();
1017
1018
      foreach ($string_array as $string) {
1019
        if (strpos($string, '=') != false) {
1020
          $parts = explode('=', $string, 2);
1021
          $sage_pay_response[trim($parts[0])] = trim($parts[1]);
1022
        }
1023
      }
1024
1025
      return $OSCOM_Db->delete('customers_sagepay_tokens', ['id' => $token_id, 'customers_id' => $_SESSION['customer_id'], 'sagepay_token' => $token]) === 1;
1026
    }

catalog/includes/modules/payment/sage_pay_form.php 2 locations

@@ 225-230 (lines=6) @@
222
        $string_array = explode('&', $transaction_response);
223
        $sage_pay_response = array('Status' => null);
224
225
        foreach ($string_array as $string) {
226
          if (strpos($string, '=') != false) {
227
            $parts = explode('=', $string, 2);
228
            $sage_pay_response[trim($parts[0])] = trim($parts[1]);
229
          }
230
        }
231
232
        if ( ($sage_pay_response['Status'] != 'OK') && ($sage_pay_response['Status'] != 'AUTHENTICATED') && ($sage_pay_response['Status'] != 'REGISTERED') ) {
233
          $this->sendDebugEmail($sage_pay_response);
@@ 315-320 (lines=6) @@
312
        $string_array = explode('&', $transaction_response);
313
        $return = array('Status' => null);
314
315
        foreach ($string_array as $string) {
316
          if (strpos($string, '=') != false) {
317
            $parts = explode('=', $string, 2);
318
            $return[trim($parts[0])] = trim($parts[1]);
319
          }
320
        }
321
322
        $error = $this->getErrorMessageNumber($return['StatusDetail']);
323

catalog/includes/modules/payment/sage_pay_server.php 1 location

@@ 233-238 (lines=6) @@
230
        $string_array = explode(chr(10), $transaction_response);
231
        $return = array();
232
233
        foreach ($string_array as $string) {
234
          if (strpos($string, '=') != false) {
235
            $parts = explode('=', $string, 2);
236
            $return[trim($parts[0])] = trim($parts[1]);
237
          }
238
        }
239
240
        if ($return['Status'] == 'OK') {
241
          $Qsp = $OSCOM_Db->get('sagepay_server_securitykeys', ['id', 'securitykey'], ['code' => $_SESSION['sagepay_server_skey_code']], null, 1);