Code Duplication    Length = 33-33 lines in 3 locations

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

@@ 668-700 (lines=33) @@
665
      return defined('MODULE_PAYMENT_SAGE_PAY_DIRECT_STATUS');
666
    }
667
668
    function install($parameter = null) {
669
      $OSCOM_Db = Registry::get('Db');
670
671
      $params = $this->getParams();
672
673
      if (isset($parameter)) {
674
        if (isset($params[$parameter])) {
675
          $params = array($parameter => $params[$parameter]);
676
        } else {
677
          $params = array();
678
        }
679
      }
680
681
      foreach ($params as $key => $data) {
682
        $sql_data_array = array('configuration_title' => $data['title'],
683
                                'configuration_key' => $key,
684
                                'configuration_value' => (isset($data['value']) ? $data['value'] : ''),
685
                                'configuration_description' => $data['desc'],
686
                                'configuration_group_id' => '6',
687
                                'sort_order' => '0',
688
                                'date_added' => 'now()');
689
690
        if (isset($data['set_func'])) {
691
          $sql_data_array['set_function'] = $data['set_func'];
692
        }
693
694
        if (isset($data['use_func'])) {
695
          $sql_data_array['use_function'] = $data['use_func'];
696
        }
697
698
        $OSCOM_Db->save('configuration', $sql_data_array);
699
      }
700
    }
701
702
    function remove() {
703
      return Registry::get('Db')->exec('delete from :table_configuration where configuration_key in ("' . implode('", "', $this->keys()) . '")');

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

@@ 348-380 (lines=33) @@
345
      return defined('MODULE_PAYMENT_SAGE_PAY_FORM_STATUS');
346
    }
347
348
    function install($parameter = null) {
349
      $OSCOM_Db = Registry::get('Db');
350
351
      $params = $this->getParams();
352
353
      if (isset($parameter)) {
354
        if (isset($params[$parameter])) {
355
          $params = array($parameter => $params[$parameter]);
356
        } else {
357
          $params = array();
358
        }
359
      }
360
361
      foreach ($params as $key => $data) {
362
        $sql_data_array = array('configuration_title' => $data['title'],
363
                                'configuration_key' => $key,
364
                                'configuration_value' => (isset($data['value']) ? $data['value'] : ''),
365
                                'configuration_description' => $data['desc'],
366
                                'configuration_group_id' => '6',
367
                                'sort_order' => '0',
368
                                'date_added' => 'now()');
369
370
        if (isset($data['set_func'])) {
371
          $sql_data_array['set_function'] = $data['set_func'];
372
        }
373
374
        if (isset($data['use_func'])) {
375
          $sql_data_array['use_function'] = $data['use_func'];
376
        }
377
378
        $OSCOM_Db->save('configuration', $sql_data_array);
379
      }
380
    }
381
382
    function remove() {
383
      return Registry::get('Db')->exec('delete from :table_configuration where configuration_key in ("' . implode('", "', $this->keys()) . '")');

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

@@ 329-361 (lines=33) @@
326
      return defined('MODULE_PAYMENT_SAGE_PAY_SERVER_STATUS');
327
    }
328
329
    function install($parameter = null) {
330
      $OSCOM_Db = Registry::get('Db');
331
332
      $params = $this->getParams();
333
334
      if (isset($parameter)) {
335
        if (isset($params[$parameter])) {
336
          $params = array($parameter => $params[$parameter]);
337
        } else {
338
          $params = array();
339
        }
340
      }
341
342
      foreach ($params as $key => $data) {
343
        $sql_data_array = array('configuration_title' => $data['title'],
344
                                'configuration_key' => $key,
345
                                'configuration_value' => (isset($data['value']) ? $data['value'] : ''),
346
                                'configuration_description' => $data['desc'],
347
                                'configuration_group_id' => '6',
348
                                'sort_order' => '0',
349
                                'date_added' => 'now()');
350
351
        if (isset($data['set_func'])) {
352
          $sql_data_array['set_function'] = $data['set_func'];
353
        }
354
355
        if (isset($data['use_func'])) {
356
          $sql_data_array['use_function'] = $data['use_func'];
357
        }
358
359
        $OSCOM_Db->save('configuration', $sql_data_array);
360
      }
361
    }
362
363
    function remove() {
364
      return Registry::get('Db')->exec('delete from :table_configuration where configuration_key in ("' . implode('", "', $this->keys()) . '")');