src/Loader/Loader.php
public static function getSingleton($pClass, array $pArgs = array())
    {
        if (strpos($pClass, Agl::AGL_CORE_POOL) === 0 or strpos($pClass, Agl::AGL_MORE_POOL) === 0) {
            $moduleArr = explode('/', $pClass);
            if (count($moduleArr) == 2) {
                $moduleArr[] = $moduleArr[1];
                $pClass      = implode('/', $moduleArr);
            }
        }

        $registryKey = '_singleton/' . strtolower($pClass);
        $instance    = Registry::get($registryKey);
        if (! $instance) {
            $instance = self::getInstance($pClass, $pArgs);
            if ($instance === NULL) {
                return NULL;
            }

            Registry::set($registryKey, $instance);
        }

        return $instance;
    }
public static function getSingleton($pClass, array $pArgs = array())
    {
        if (strpos($pClass, Agl::AGL_CORE_POOL) === 0 or strpos($pClass, Agl::AGL_MORE_POOL) === 0) {
            $moduleArr = explode('/', $pClass);
            if (count($moduleArr) == 2) {
                $moduleArr[] = $moduleArr[1];
                $pClass      = implode('/', $moduleArr);
            }
        }

        $registryKey = '_singleton/' . strtolower($pClass);
        $instance    = Registry::get($registryKey);
        if (! $instance) {
            $instance = self::getInstance($pClass, $pArgs);
            if ($instance === NULL) {
                return NULL;
            }

            Registry::set($registryKey, $instance);
        }

        return $instance;
    }
public static function getSingleton ( $ pClass , array $ pArgs = array ( ) ) { if ( strpos ( $ pClass , Agl :: AGL_CORE_POOL ) === 0 or strpos ( $ pClass , Agl :: AGL_MORE_POOL ) === 0 ) { $ moduleArr = explode ( '/' , $ pClass ) ; if ( count ( $ moduleArr ) == 2 ) { $ moduleArr [ ] = $ moduleArr [ 1 ] ; $ pClass = implode ( '/' , $ moduleArr ) ; } } $ registryKey = '_singleton/' . strtolower ( $ pClass ) ; $ instance = Registry :: get ( $ registryKey ) ; if ( ! $ instance ) { $ instance = self :: getInstance ( $ pClass , $ pArgs ) ; if ( $ instance === NULL ) { return NULL ; } Registry :: set ( $ registryKey , $ instance ) ; } return $ instance ; }
Create a new instance of the requested class as a singleton.

@param string $pClass Class path
@param array $pArgs Arguments to construct the requested class
@return mixed
Create a new instance of the requested class as a singleton .