Compiler.php
public function resolvePath($path, $extensions = null)
    {

        $paths = $this->options['paths'];
        $exts = $extensions ? $extensions : $this->options['extensions'];

        if (is_array($exts)) {

            foreach ($exts as $ext)
                if ($resolved = $this->resolvePath($path, $ext))
                    return $resolved;

            return false;
        }

        $ext = $exts;

        if (substr($path, -strlen($ext)) !== $ext)
            $path .= $ext;

        //Check static path
        if (file_exists($path))
            return $path;

        if (count($paths) < 1) {

            //We got no paths to search in. We use the include-path in that case
            $paths = explode(\PATH_SEPARATOR, get_include_path());
        }

        //Add the path were currently compiling in (e.g. include, extends)
        if (count($this->files) > 0)
            $paths[] = dirname(end($this->files));

        //Iterate paths and check file existence via realpath
        foreach ($paths as $directory) {

            $fullPath = realpath(rtrim($directory, '/\\').'/'.ltrim($path, '/\\'));

            if ($fullPath)
                return $fullPath;
        }

        return false;
    }
public function resolvePath($path, $extensions = null)
    {

        $paths = $this->options['paths'];
        $exts = $extensions ? $extensions : $this->options['extensions'];

        if (is_array($exts)) {

            foreach ($exts as $ext)
                if ($resolved = $this->resolvePath($path, $ext))
                    return $resolved;

            return false;
        }

        $ext = $exts;

        if (substr($path, -strlen($ext)) !== $ext)
            $path .= $ext;

        //Check static path
        if (file_exists($path))
            return $path;

        if (count($paths) < 1) {

            //We got no paths to search in. We use the include-path in that case
            $paths = explode(\PATH_SEPARATOR, get_include_path());
        }

        //Add the path were currently compiling in (e.g. include, extends)
        if (count($this->files) > 0)
            $paths[] = dirname(end($this->files));

        //Iterate paths and check file existence via realpath
        foreach ($paths as $directory) {

            $fullPath = realpath(rtrim($directory, '/\\').'/'.ltrim($path, '/\\'));

            if ($fullPath)
                return $fullPath;
        }

        return false;
    }
public function resolvePath ( $ path , $ extensions = null ) { $ paths = $ this -> options [ 'paths' ] ; $ exts = $ extensions ? $ extensions : $ this -> options [ 'extensions' ] ; if ( is_array ( $ exts ) ) { foreach ( $ exts as $ ext ) if ( $ resolved = $ this -> resolvePath ( $ path , $ ext ) ) return $ resolved ; return false ; } $ ext = $ exts ; if ( substr ( $ path , - strlen ( $ ext ) ) !== $ ext ) $ path .= $ ext ; //Check static path if ( file_exists ( $ path ) ) return $ path ; if ( count ( $ paths ) < 1 ) { //We got no paths to search in. We use the include-path in that case $ paths = explode ( \ PATH_SEPARATOR , get_include_path ( ) ) ; } //Add the path were currently compiling in (e.g. include, extends) if ( count ( $ this -> files ) > 0 ) $ paths [ ] = dirname ( end ( $ this -> files ) ) ; //Iterate paths and check file existence via realpath foreach ( $ paths as $ directory ) { $ fullPath = realpath ( rtrim ( $ directory , '/\\' ) . '/' . ltrim ( $ path , '/\\' ) ) ; if ( $ fullPath ) return $ fullPath ; } return false ; }
Resolves a path respecting the paths given in the options.

The final paths for resolving are put together as follows:

when paths options not empty      => Add paths of paths-option
when paths option empty           => Add paths of get_include_path()
when current file stack not empty => Add directory of last file we
were compiling

We then look for a path with the given extension inside
all paths we work on currently

@param string       $path       the relative path to resolve
@param array|string $extensions the extensions to resolve with

@return string|false the resolved full path or false, if not found
Resolves a path respecting the paths given in the options .