public static function getSingletonInstance($className, array $arguments = array())
    {	
    	
    	$registerKey = $className;
    
        if (!isset(self::$_registry[$registerKey])) {

        	if(class_exists($className)) {
            	self::$_registry[$registerKey] = new $className($arguments);
            	
        	}else {
 
        		throw new Exception ('Invalid class name:: ' .$className."(".print_r($arguments,1).')');
        	}
        }


        return  self::$_registry[$registerKey];
    }
public static function getSingletonInstance($className, array $arguments = array())
    {	
    	
    	$registerKey = $className;
    
        if (!isset(self::$_registry[$registerKey])) {

        	if(class_exists($className)) {
            	self::$_registry[$registerKey] = new $className($arguments);
            	
        	}else {
 
        		throw new Exception ('Invalid class name:: ' .$className."(".print_r($arguments,1).')');
        	}
        }


        return  self::$_registry[$registerKey];
    }
public static function getSingletonInstance ( $ className , array $ arguments = array ( ) ) { $ registerKey = $ className ; if ( ! isset ( self :: $ _registry [ $ registerKey ] ) ) { if ( class_exists ( $ className ) ) { self :: $ _registry [ $ registerKey ] = new $ className ( $ arguments ) ; } else { throw new Exception ( 'Invalid class name:: ' . $ className . "(" . print_r ( $ arguments , 1 ) . ')' ) ; } } return self :: $ _registry [ $ registerKey ] ; }
This helper method create a singleton object , given the name of the class
@param $className
@param array $arguments arguemnet for class constructor
@return mixed
@throws Exception
Simple usage:
CheckoutApi_Lib_Factory::getSingletonInstance('CheckoutApi_Client_ClientGW3');
This helper method create a singleton object given the name of the class