public function loadClass($className)
    {
        $origClassName = str_replace('-', '', $className);

        /**/$this->app->pr->start('pathfinder/loadClass ');

        /**/$this->app->pr->next('pathfinder/loadClass/convertpath ');
        $className = ltrim($className, '\\');
        $nsPath = '';
        $namespace = '';
        if ($lastNsPos = strripos($className, '\\')) {
            $namespace = substr($className, 0, $lastNsPos);
            $className = substr($className, $lastNsPos + 1);
            $nsPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace);
        }
        $classPath = str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';

        /**/$this->app->pr->next('pathfinder/loadClass/locate ');
        try {
            if ($namespace) {
                if (strpos($className, 'page_') === 0) {
                    $path = $this->app->locatePath(
                        'addons',
                        $nsPath.DIRECTORY_SEPARATOR.$classPath
                    );
                } else {
                    $path = $this->app->locatePath(
                        'addons',
                        $nsPath.DIRECTORY_SEPARATOR
                        .'lib'.DIRECTORY_SEPARATOR.$classPath
                    );
                }
            } else {
                if (strpos($className, 'page_') === 0) {
                    $path = $this->app->locatePath(
                        'page',
                        substr($classPath, 5)
                    );
                } else {
                    $path = $this->app->locatePath(
                        'php',
                        $classPath
                    );
                }
            }
        } catch (Exception_PathFinder $e) {
            $e
                ->addMoreInfo('class', $className)
                ->addMoreInfo('namespace', $namespace)
                ->addMoreInfo('orig_class', $origClassName)
                ;
            throw $e;
        }

        if (!is_readable($path)) {
            throw new Exception_PathFinder('addon', $path, $prefix);
        }

        /**/$this->app->pr->next('pathfinder/loadClass/include ');
        /**/$this->app->pr->start('php parsing');
        include_once $path;

        if (!class_exists($origClassName, false) && !interface_exists($origClassName, false)) {
            throw $this->exception('Class is not defined in file or extended class can not be found')
                ->addMoreInfo('file', $path)
                ->addMoreInfo('namespace', $namespace)
                ->addMoreInfo('class', $className)
                ;
        }
        /**/$this->app->pr->stop();

        return $path;
    }
public function loadClass($className)
    {
        $origClassName = str_replace('-', '', $className);

        /**/$this->app->pr->start('pathfinder/loadClass ');

        /**/$this->app->pr->next('pathfinder/loadClass/convertpath ');
        $className = ltrim($className, '\\');
        $nsPath = '';
        $namespace = '';
        if ($lastNsPos = strripos($className, '\\')) {
            $namespace = substr($className, 0, $lastNsPos);
            $className = substr($className, $lastNsPos + 1);
            $nsPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace);
        }
        $classPath = str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';

        /**/$this->app->pr->next('pathfinder/loadClass/locate ');
        try {
            if ($namespace) {
                if (strpos($className, 'page_') === 0) {
                    $path = $this->app->locatePath(
                        'addons',
                        $nsPath.DIRECTORY_SEPARATOR.$classPath
                    );
                } else {
                    $path = $this->app->locatePath(
                        'addons',
                        $nsPath.DIRECTORY_SEPARATOR
                        .'lib'.DIRECTORY_SEPARATOR.$classPath
                    );
                }
            } else {
                if (strpos($className, 'page_') === 0) {
                    $path = $this->app->locatePath(
                        'page',
                        substr($classPath, 5)
                    );
                } else {
                    $path = $this->app->locatePath(
                        'php',
                        $classPath
                    );
                }
            }
        } catch (Exception_PathFinder $e) {
            $e
                ->addMoreInfo('class', $className)
                ->addMoreInfo('namespace', $namespace)
                ->addMoreInfo('orig_class', $origClassName)
                ;
            throw $e;
        }

        if (!is_readable($path)) {
            throw new Exception_PathFinder('addon', $path, $prefix);
        }

        /**/$this->app->pr->next('pathfinder/loadClass/include ');
        /**/$this->app->pr->start('php parsing');
        include_once $path;

        if (!class_exists($origClassName, false) && !interface_exists($origClassName, false)) {
            throw $this->exception('Class is not defined in file or extended class can not be found')
                ->addMoreInfo('file', $path)
                ->addMoreInfo('namespace', $namespace)
                ->addMoreInfo('class', $className)
                ;
        }
        /**/$this->app->pr->stop();

        return $path;
    }
public function loadClass ( $ className ) { $ origClassName = str_replace ( '-' , '' , $ className ) ; /**/ $ this -> app -> pr -> start ( 'pathfinder/loadClass ' ) ; /**/ $ this -> app -> pr -> next ( 'pathfinder/loadClass/convertpath ' ) ; $ className = ltrim ( $ className , '\\' ) ; $ nsPath = '' ; $ namespace = '' ; if ( $ lastNsPos = strripos ( $ className , '\\' ) ) { $ namespace = substr ( $ className , 0 , $ lastNsPos ) ; $ className = substr ( $ className , $ lastNsPos + 1 ) ; $ nsPath = str_replace ( '\\' , DIRECTORY_SEPARATOR , $ namespace ) ; } $ classPath = str_replace ( '_' , DIRECTORY_SEPARATOR , $ className ) . '.php' ; /**/ $ this -> app -> pr -> next ( 'pathfinder/loadClass/locate ' ) ; try { if ( $ namespace ) { if ( strpos ( $ className , 'page_' ) === 0 ) { $ path = $ this -> app -> locatePath ( 'addons' , $ nsPath . DIRECTORY_SEPARATOR . $ classPath ) ; } else { $ path = $ this -> app -> locatePath ( 'addons' , $ nsPath . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . $ classPath ) ; } } else { if ( strpos ( $ className , 'page_' ) === 0 ) { $ path = $ this -> app -> locatePath ( 'page' , substr ( $ classPath , 5 ) ) ; } else { $ path = $ this -> app -> locatePath ( 'php' , $ classPath ) ; } } } catch ( Exception_PathFinder $ e ) { $ e -> addMoreInfo ( 'class' , $ className ) -> addMoreInfo ( 'namespace' , $ namespace ) -> addMoreInfo ( 'orig_class' , $ origClassName ) ; throw $ e ; } if ( ! is_readable ( $ path ) ) { throw new Exception_PathFinder ( 'addon' , $ path , $ prefix ) ; } /**/ $ this -> app -> pr -> next ( 'pathfinder/loadClass/include ' ) ; /**/ $ this -> app -> pr -> start ( 'php parsing' ) ; include_once $ path ; if ( ! class_exists ( $ origClassName , false ) && ! interface_exists ( $ origClassName , false ) ) { throw $ this -> exception ( 'Class is not defined in file or extended class can not be found' ) -> addMoreInfo ( 'file' , $ path ) -> addMoreInfo ( 'namespace' , $ namespace ) -> addMoreInfo ( 'class' , $ className ) ; } /**/ $ this -> app -> pr -> stop ( ) ; return $ path ; }
Provided with a class name, this will attempt to
find and load it.

@return string path from where the class was loaded
Provided with a class name this will attempt to find and load it .