Graby\Graby::makeAbsoluteStr PHP Method

makeAbsoluteStr() private method

Make an $url absolute based on the $base.
private makeAbsoluteStr ( string $base, string $url ) : false | string
$base string Base url
$url string Url to make it absolute
return false | string
    private function makeAbsoluteStr($base, $url)
    {
        if (!$url) {
            return false;
        }
        if (preg_match('!^https?://!i', $url)) {
            // already absolute
            return $url;
        }
        $base = new \SimplePie_IRI($base);
        // remove '//' in URL path (causes URLs not to resolve properly)
        if (isset($base->ipath)) {
            $base->ipath = preg_replace('!//+!', '/', $base->ipath);
        }
        if ($absolute = \SimplePie_IRI::absolutize($base, $url)) {
            return $absolute->get_uri();
        }
        return false;
    }