public static function getInstance() { if (!is_object(self::$_instance)) { //or if( is_null(self::$_instance) ) or if( self::$_instance == null ) self::$_instance = new Engine_Payment_Paypal_Paypal(); } return self::$_instance; }
public static function getInstance() { if (!is_object(self::$_instance)) { $objCore = Engine_Core_Core::getInstance(); $appSetting = $objCore->getAppSetting(); switch ($appSetting->payment) { case "Paypal": self::$_instance = Engine_Payment_Paypal_Paypal::getInstance(); break; case "Authorize": self::$_instance = Engine_Payment_Authorize_Authorize::getInstance(); break; default: throw new Zend_Controller_Action_Exception('Payment method not selected', 500); break; } } return self::$_instance; }