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

            if (strpos($pClass, Agl::AGL_MORE_POOL) === 0) {
                self::$_loadedModules[strtolower(implode('/', $moduleArr))] = true;
            }

            $path = '\\' . Autoload::AGL_POOL . '\\' . implode('\\', $moduleArr);

            if (empty($pArgs)) {
                return new $path();
            } else {
                $reflect = new ReflectionClass($path);
                return $reflect->newInstanceArgs($pArgs);
            }
        } else if (strpos($pClass, ModelInterface::APP_PHP_HELPER_DIR) === 0) {
            return self::getHelper(str_replace(ModelInterface::APP_PHP_HELPER_DIR . '/', '', $pClass));
        } else if (strpos($pClass, ModelInterface::APP_PHP_DIR) === 0) {
            return self::getModel(str_replace(ModelInterface::APP_PHP_DIR . '/', '', $pClass));
        } else if (strpos($pClass, CollectionInterface::APP_PHP_DIR) === 0) {
            return self::getCollection(str_replace(CollectionInterface::APP_PHP_DIR . '/', '', $pClass));
        }

        try {
            $reflect = new ReflectionClass($pClass);
            return $reflect->newInstanceArgs($pArgs);
        } catch (ReflectionException $e) {
            return NULL;
        }
    }
public static function getInstance($pClass, array $pArgs = array())
    {
        if (strpos($pClass, Agl::AGL_CORE_POOL) === 0 or strpos($pClass, Agl::AGL_MORE_POOL) === 0) {
            $moduleArr = explode('/', $pClass);
            $moduleArr = array_map('ucfirst', $moduleArr);
            if (count($moduleArr) == 2) {
                $moduleArr[] = $moduleArr[1];
            }

            if (strpos($pClass, Agl::AGL_MORE_POOL) === 0) {
                self::$_loadedModules[strtolower(implode('/', $moduleArr))] = true;
            }

            $path = '\\' . Autoload::AGL_POOL . '\\' . implode('\\', $moduleArr);

            if (empty($pArgs)) {
                return new $path();
            } else {
                $reflect = new ReflectionClass($path);
                return $reflect->newInstanceArgs($pArgs);
            }
        } else if (strpos($pClass, ModelInterface::APP_PHP_HELPER_DIR) === 0) {
            return self::getHelper(str_replace(ModelInterface::APP_PHP_HELPER_DIR . '/', '', $pClass));
        } else if (strpos($pClass, ModelInterface::APP_PHP_DIR) === 0) {
            return self::getModel(str_replace(ModelInterface::APP_PHP_DIR . '/', '', $pClass));
        } else if (strpos($pClass, CollectionInterface::APP_PHP_DIR) === 0) {
            return self::getCollection(str_replace(CollectionInterface::APP_PHP_DIR . '/', '', $pClass));
        }

        try {
            $reflect = new ReflectionClass($pClass);
            return $reflect->newInstanceArgs($pArgs);
        } catch (ReflectionException $e) {
            return NULL;
        }
    }
public static function getInstance ( $ pClass , array $ pArgs = array ( ) ) { if ( strpos ( $ pClass , Agl :: AGL_CORE_POOL ) === 0 or strpos ( $ pClass , Agl :: AGL_MORE_POOL ) === 0 ) { $ moduleArr = explode ( '/' , $ pClass ) ; $ moduleArr = array_map ( 'ucfirst' , $ moduleArr ) ; if ( count ( $ moduleArr ) == 2 ) { $ moduleArr [ ] = $ moduleArr [ 1 ] ; } if ( strpos ( $ pClass , Agl :: AGL_MORE_POOL ) === 0 ) { self :: $ _loadedModules [ strtolower ( implode ( '/' , $ moduleArr ) ) ] = true ; } $ path = '\\' . Autoload :: AGL_POOL . '\\' . implode ( '\\' , $ moduleArr ) ; if ( empty ( $ pArgs ) ) { return new $ path ( ) ; } else { $ reflect = new ReflectionClass ( $ path ) ; return $ reflect -> newInstanceArgs ( $ pArgs ) ; } } else if ( strpos ( $ pClass , ModelInterface :: APP_PHP_HELPER_DIR ) === 0 ) { return self :: getHelper ( str_replace ( ModelInterface :: APP_PHP_HELPER_DIR . '/' , '' , $ pClass ) ) ; } else if ( strpos ( $ pClass , ModelInterface :: APP_PHP_DIR ) === 0 ) { return self :: getModel ( str_replace ( ModelInterface :: APP_PHP_DIR . '/' , '' , $ pClass ) ) ; } else if ( strpos ( $ pClass , CollectionInterface :: APP_PHP_DIR ) === 0 ) { return self :: getCollection ( str_replace ( CollectionInterface :: APP_PHP_DIR . '/' , '' , $ pClass ) ) ; } try { $ reflect = new ReflectionClass ( $ pClass ) ; return $ reflect -> newInstanceArgs ( $ pArgs ) ; } catch ( ReflectionException $ e ) { return NULL ; } }
Create a new instance of the requested class.

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