src/Base.php
protected static function getSingleton($class = null)
    {
        //super magic sauce getting the callers class
        if (is_null($class) && function_exists('get_called_class')) {
            $class = get_called_class();
        }
        
        //get routed class, if any
        $class = Route::i()->get($class);
        
        //if it's not set
        if (!isset(self::$instances[$class])) {
            //set it
            self::$instances[$class] = self::getInstance($class);
        }
        
        //return the cached version
        return self::$instances[$class];
    }
protected static function getSingleton($class = null)
    {
        //super magic sauce getting the callers class
        if (is_null($class) && function_exists('get_called_class')) {
            $class = get_called_class();
        }
        
        //get routed class, if any
        $class = Route::i()->get($class);
        
        //if it's not set
        if (!isset(self::$instances[$class])) {
            //set it
            self::$instances[$class] = self::getInstance($class);
        }
        
        //return the cached version
        return self::$instances[$class];
    }
protected static function getSingleton ( $ class = null ) { //super magic sauce getting the callers class if ( is_null ( $ class ) && function_exists ( 'get_called_class' ) ) { $ class = get_called_class ( ) ; } //get routed class, if any $ class = Route :: i ( ) -> get ( $ class ) ; //if it's not set if ( ! isset ( self :: $ instances [ $ class ] ) ) { //set it self :: $ instances [ $ class ] = self :: getInstance ( $ class ) ; } //return the cached version return self :: $ instances [ $ class ] ; }
Returns the same instance if instantiated already
while considering routes.

@param string|null $class name of the class

@return object
Returns the same instance if instantiated already while considering routes .