Code Duplication    Length = 33-33 lines in 2 locations

catalog/includes/apps/braintree/OSCOM_Braintree.php 1 location

@@ 627-659 (lines=33) @@
624
      return $output;
625
    }
626
627
    function install($module) {
628
      $cut_length = strlen('OSCOM_APP_PAYPAL_BRAINTREE_' . $module . '_');
629
630
      foreach ( $this->getParameters($module) as $key ) {
631
        $p = strtolower(substr($key, $cut_length));
632
633
        $cfg_class = 'OSCOM_Braintree_' . $module . '_Cfg_' . $p;
634
635
        if ( !class_exists($cfg_class) ) {
636
          $this->loadLanguageFile('modules/' . $module . '/cfg_params/' . $p . '.php');
637
638
          include(DIR_FS_CATALOG . 'includes/apps/braintree/modules/' . $module . '/cfg_params/' . $p . '.php');
639
        }
640
641
        $cfg = new $cfg_class();
642
643
        $this->saveParameter($key, $cfg->default, isset($cfg->title) ? $cfg->title : null, isset($cfg->description) ? $cfg->description : null, isset($cfg->set_func) ? $cfg->set_func : null);
644
      }
645
646
      $m_class = 'OSCOM_Braintree_' . $module;
647
648
      if ( !class_exists($m_class) ) {
649
        $this->loadLanguageFile('modules/' . $module . '/' . $module . '.php');
650
651
        include(DIR_FS_CATALOG . 'includes/apps/braintree/modules/' . $module . '/' . $module . '.php');
652
      }
653
654
      $m = new $m_class();
655
656
      if ( method_exists($m, 'install') ) {
657
        $m->install($this);
658
      }
659
    }
660
661
    function uninstall($module) {
662
      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'OSCOM_APP_PAYPAL_BRAINTREE_" . tep_db_input($module) . "_%'");

catalog/includes/apps/paypal/OSCOM_PayPal.php 1 location

@@ 681-713 (lines=33) @@
678
      return $output;
679
    }
680
681
    function install($module) {
682
      $cut_length = strlen('OSCOM_APP_PAYPAL_' . $module . '_');
683
684
      foreach ( $this->getParameters($module) as $key ) {
685
        $p = strtolower(substr($key, $cut_length));
686
687
        $cfg_class = 'OSCOM_PayPal_' . $module . '_Cfg_' . $p;
688
689
        if ( !class_exists($cfg_class) ) {
690
          $this->loadLanguageFile('modules/' . $module . '/cfg_params/' . $p . '.php');
691
692
          include(DIR_FS_CATALOG . 'includes/apps/paypal/modules/' . $module . '/cfg_params/' . $p . '.php');
693
        }
694
695
        $cfg = new $cfg_class();
696
697
        $this->saveParameter($key, $cfg->default, isset($cfg->title) ? $cfg->title : null, isset($cfg->description) ? $cfg->description : null, isset($cfg->set_func) ? $cfg->set_func : null);
698
      }
699
700
      $m_class = 'OSCOM_PayPal_' . $module;
701
702
      if ( !class_exists($m_class) ) {
703
        $this->loadLanguageFile('modules/' . $module . '/' . $module . '.php');
704
705
        include(DIR_FS_CATALOG . 'includes/apps/paypal/modules/' . $module . '/' . $module . '.php');
706
      }
707
708
      $m = new $m_class();
709
710
      if ( method_exists($m, 'install') ) {
711
        $m->install($this);
712
      }
713
    }
714
715
    function uninstall($module) {
716
      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'OSCOM_APP_PAYPAL_" . tep_db_input($module) . "_%'");