Phan\Language\FileRef::getProjectRelativePath PHP Method

getProjectRelativePath() public method

public getProjectRelativePath ( ) : string
return string The path of the file relative to the project root directory
    public function getProjectRelativePath() : string
    {
        $cwd_relative_path = $this->file;
        // Get a path relative to the project root
        $path = str_replace(Config::get()->getProjectRootDirectory(), '', realpath($cwd_relative_path) ?: $cwd_relative_path);
        // Strip any beginning directory separators
        if (0 === ($pos = strpos($path, DIRECTORY_SEPARATOR))) {
            $path = substr($path, $pos + 1);
        }
        return $path;
    }