Works out what the URL for this link should be based on it's Type

@return bool|mixed|null|string
549734
public function getLinkURL()
    {
        if (!$this->ID) {
            return '';
        }

        $type = $this->Type;
        switch ($type) {
            case 'URL':
                $LinkURL = $this->URL;
                break;
            case 'Email':
                $LinkURL = $this->Email ? "mailto:$this->Email" : null;
                break;
            case 'Phone':
                $LinkURL = $this->Phone ? "tel:$this->Phone" : null;
                break;
            default:
                if ($this->getTypeHasDbField()) {
                    $LinkURL = $this->{$type};
                } else {
                    if ($type && $component = $this->getComponent($type)) {
                        if (!$component->exists()) {
                            $LinkURL = false;
                        } elseif ($component->hasMethod('Link')) {
                            $LinkURL = $component->Link() . $this->Anchor;
                        } else {
                            $LinkURL = "Please implement a Link() method on your dataobject \"$type\"";
                        }
                    }
                }
                break;
        }

        $this->extend('updateLinkURL', $LinkURL);

        return $LinkURL;
    }
123466
public function getUrl()
    {
        $https = $this->isHTTPS();

        $protocol = strtolower($_SERVER["SERVER_PROTOCOL"]);
        $protocol = substr($protocol, 0, strpos($protocol, "/")) . ($https ? "s" : "");

        $port = $_SERVER["SERVER_PORT"];
        $port = ($port == 80 && !$https) || ($port == 443 && $https) ? "" : ":$port";

        $host = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : null;
        $host = $host ? $host : $_SERVER["SERVER_NAME"] . $port;

        return "$protocol://$host" . $_SERVER["REQUEST_URI"];
    }
30197
public function redirectionLink()
    {
        // Check external redirect
        if ($this->RedirectionType == 'External') {
            return $this->ExternalURL ?: null;
        }

        // Check internal redirect
        /** @var SiteTree $linkTo */
        $linkTo = $this->LinkToID ? SiteTree::get()->byID($this->LinkToID) : null;
        if (empty($linkTo)) {
            return null;
        }

        // We shouldn't point to ourselves - that would create an infinite loop!  Return null since we have a
        // bad configuration
        if ($this->ID == $linkTo->ID) {
            return null;
        }

        // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of redirector
        // pages from causing an infinite loop.  Instead, they will cause a 30x redirection loop in the browser, but
        // this can be handled sufficiently gracefully by the browser.
        if ($linkTo instanceof RedirectorPage) {
            return $linkTo->regularLink();
        }

        // For all other pages, just return the link of the page.
        return $linkTo->Link();
    }
1120083
public function getType() : ?string
    {
        if (null === $this->type) {
            $success = null;

            try {
                $type = $this->getItem('browscap.type', false, $success);
            } catch (InvalidArgumentException $e) {
                $this->logger->error(new \InvalidArgumentException('an error occured while reading the data type from the cache', 0, $e));
                $type = null;
            }

            if (null !== $type && $success) {
                $this->type = $type;
            }
        }

        return $this->type;
    }
792146
public function URL()
    {
        $p = $this->parse();
        $link = '';

        $link .= (!empty($p['scheme'])) ? $p['scheme'] . '://' : false;
        $link .= (!empty($p['user'])) ? $p['user'] . ':' : false;
        $link .= (!empty($p['pass'])) ? $p['pass'] . '@' : false;
        $link .= (!empty($p['host'])) ? $p['host'] : false;
        $link .= (!empty($p['path'])) ? $p['path'] : false;
        if (!empty($p['query'])) {
            parse_str($p['query'], $get_array);
            $link .= '?' . http_build_query($get_array, '', '&amp;');
        }
        $link .= (!empty($p['fragment'])) ? '#' . $p['fragment'] : false;

        return $link;
    }
1243506
public function getLink()
    {
        return ($this->_link === null) ? Yii::$app->menu->buildItemLink($this->alias, $this->getLang()) : $this->_link;
    }
821551
public function getUrlPK()
    {
        if ($this->urlPK == null) {
            $this->urlPK = $this->getPrimaryKey();
        }

        return $this->urlPK;
    }
281719
public function getType()
    {
        if($this->_type == null) {
            $this->_type = parse_url($this->_path, PHP_URL_HOST);
        }

        return $this->_type;
    }
465929
public function link($urnOrRelType, $urn = null)
    {
        $relTypeKeys = array_keys(get_object_vars($this->links));
        if ($urn) {
            $relTypeKeys = [$urnOrRelType];
        } else {
            $urn = $urnOrRelType;
        }

        // look for a matching urn within the links
        foreach ($relTypeKeys as $relType) {
            $links = $this->links($relType);
            $matching = $links->rel($urn);
            if ($matching) {
                return $matching;
            }
        }
        return null;
    }
11542
public function baseURI($href = null)
    {
        if (func_num_args() < 1) {
            $href = @$this->_prop['baseURI'];
        } else {
            if ($href) {
                $t = self::get_url_base($href, true);
                if (!$t) {
                    return false;
                }

                list($bh, $bu) = $t;
            } else {
                $bh = $bu = null;
            }
            $this->_prop['hostURL'] = $bh;
            $this->_prop['baseURL'] = $bu;
            $this->_prop['baseURI'] = $href;
        }

        return $href;
    }
453881
protected function getLink()
    {
        if ($this->link_value === null) {
            $link = $this->link;
        } elseif (is_array($this->link_value)) {
            $link_values = array();

            foreach ($this->link_value as $value) {
                $link_values[] = urlencode($value);
            }

            $link = vsprintf($this->link, $link_values);
        } else {
            $link_value = urlencode($this->link_value);
            $link = sprintf($this->link, $link_value);
        }

        return $link;
    }
58063
public function getUrlAttribute()
    {
        if ($this->url === null) {
            $this->url = $this->makeUrl();
        }

        return $this->url;
    }
1168528
public function getUrl()
    {
        // Ensure in request cycle (even for override).
        if ($this->request === null) {
            return null;
        }

        // Ensure request has been matched
        if (!$this->request->attributes->get('_route')) {
            return null;
        }

        if ($this->override) {
            $this->resolveCurrentOverride();

            return (string) $this->override;
        }

        return $this->urlGenerator->generate(
            $this->request->attributes->get('_route'),
            $this->request->attributes->get('_route_params'),
            UrlGeneratorInterface::ABSOLUTE_URL
        );
    }
922599
public function getSelfActionLink()
    {
        if (($sValue = $this->getViewConfigParam('selfactionlink')) === null) {
            $sValue = $this->getConfig()->getShopCurrentUrl();
            $this->setViewConfigParam('selfactionlink', $sValue);
        }

        return $sValue;
    }
96904
public function viewLink()
    {
        $link   = null;
        $locale = $this->lang();
        if ($locale !== null) {
            $translator = $this->translator();
            $origLocale = $translator->getLocale();
            $translator->setLocale($this->lang());
            $link = $this->renderTemplate('{{# withBaseUrl }}{{ obj.url }}{{/ withBaseUrl }}');
            $translator->setLocale($origLocale);
        }

        return $link;
    }
53635
private function getLink()
    {
        $linkConfig = $this->config['link'];

        if (is_string($linkConfig) || isset($linkConfig['uri'])) {
            return (is_string($linkConfig)) ? $linkConfig : $linkConfig['uri'];
        }

        return $this->router->generate($linkConfig['route_name'], $linkConfig['route_params'], UrlGeneratorInterface::ABSOLUTE_URL);
    }
1348668
public function getCheckoutUrl()
    {
        if (empty($this->_links->checkout)) {
            return null;
        }

        return $this->_links->checkout->href;
    }