Esempio n. 1
0
 public static function getInstance($type)
 {
     static $instance;
     $className = "osePaymentSC{$type}";
     $arrayInstance = array();
     $arrayInstance['MscList'] = 'osePaymentMscList';
     $arrayInstance['View'] = 'osePaymentView';
     $arrayInstance['Price'] = 'osePaymentPrice';
     $arrayInstance['Tax'] = 'osePaymentTax';
     $arrayInstance['GateWay'] = 'osePaymentGateWay';
     if (isset($arrayInstance[$type])) {
         if (strtolower($type) == 'price') {
             $primaryCurrency = osePayment::getCurrencyInfo();
             $instance = new osePaymentPrice($primaryCurrency->value, oseJson::decode($primaryCurrency->default));
             return $instance;
         }
         $className = $arrayInstance[$type];
     } else {
         $className = "osePaymentSC{$type}";
     }
     if (!$instance instanceof $className) {
         $instance = new $className();
     }
     return $instance;
 }