public static function singleton($class = null)
    {
        if (!$class) {
            $class = get_called_class();
        }

        if (!isset(self::$singletons[$class])) {
            self::$singletons[$class] = self::create($class);
        }

        return self::$singletons[$class];
    }
public static function singleton($class = null)
    {
        if (!$class) {
            $class = get_called_class();
        }

        if (!isset(self::$singletons[$class])) {
            self::$singletons[$class] = self::create($class);
        }

        return self::$singletons[$class];
    }
public static function singleton ( $ class = null ) { if ( ! $ class ) { $ class = get_called_class ( ) ; } if ( ! isset ( self :: $ singletons [ $ class ] ) ) { self :: $ singletons [ $ class ] = self :: create ( $ class ) ; } return self :: $ singletons [ $ class ] ; }
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class.

@param string $class Optional classname to create, if the called class should not be used

@return static The singleton instance
Creates a class instance by the singleton design pattern . It will always return the same instance for this class .