Timber\ImageHelper::_get_file_url PHP Method

_get_file_url() private static method

Builds the public URL of a file based on its different components
private static _get_file_url ( integer $base, string $subdir, string $filename, boolean $absolute ) : string
$base integer one of self::BASE_UPLOADS, self::BASE_CONTENT to indicate if file is an upload or a content (theme or plugin)
$subdir string subdirectory in which file is stored, relative to $base root folder
$filename string file name, including extension (but no path)
$absolute boolean should the returned URL be absolute (include protocol+host), or relative
return string the URL
    private static function _get_file_url($base, $subdir, $filename, $absolute)
    {
        $url = '';
        if (self::BASE_UPLOADS == $base) {
            $upload_dir = wp_upload_dir();
            $url = $upload_dir['baseurl'];
        }
        if (self::BASE_CONTENT == $base) {
            $url = content_url();
        }
        if (!empty($subdir)) {
            $url .= $subdir;
        }
        $url .= '/' . $filename;
        if (!$absolute) {
            $url = str_replace(site_url(), '', $url);
        }
        // $url = TimberURLHelper::remove_double_slashes( $url);
        return $url;
    }