Code Duplication    Length = 12-12 lines in 2 locations

catalog/includes/apps/braintree/hooks/admin/orders/tab.php 2 locations

@@ 165-176 (lines=12) @@
162
163
        $last_status = array();
164
165
        foreach (explode("\n", $s['comments']) as $status) {
166
          if (!empty($status) && (strpos($status, ':') !== false) && (substr($status, 0, 1) !== '[')) {
167
            $entry = explode(':', $status, 2);
168
169
            $key = trim($entry[0]);
170
            $value = trim($entry[1]);
171
172
            if ((strlen($key) > 0) && (strlen($value) > 0)) {
173
              $last_status[$key] = $value;
174
            }
175
          }
176
        }
177
178
        if (($last_status['Payment Status'] == 'authorized') || ($last_status['Payment Status'] == 'submitted_for_settlement')) {
179
          $v_query = tep_db_query("select comments from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order['orders_id'] . "' and orders_status_id = '" . (int)OSCOM_APP_PAYPAL_TRANSACTIONS_ORDER_STATUS_ID . "' and (comments like 'Braintree App: Void (%' or comments like 'Braintree App: Refund (%') limit 1");
@@ 238-249 (lines=12) @@
235
236
        $last_status = array();
237
238
        foreach (explode("\n", $s['comments']) as $status) {
239
          if (!empty($status) && (strpos($status, ':') !== false) && (substr($status, 0, 1) !== '[')) {
240
            $entry = explode(':', $status, 2);
241
242
            $key = trim($entry[0]);
243
            $value = trim($entry[1]);
244
245
            if ((strlen($key) > 0) && (strlen($value) > 0)) {
246
              $last_status[$key] = $value;
247
            }
248
          }
249
        }
250
251
        if (($last_status['Payment Status'] == 'settled') || ($last_status['Payment Status'] == 'settling')) {
252
          $refund_total = $this->_app->formatCurrencyRaw($order['total'], $order['currency'], $order['currency_value']);