Embera\Providers::getHost PHP Метод

getHost() защищенный Метод

Gets a normalized host for the given $url
protected getHost ( string $url ) : string
$url string
Результат string
    protected function getHost($url)
    {
        $data = parse_url($url);
        if (empty($data['host'])) {
            throw new \InvalidArgumentException('The Url: ' . $url . ' seems to be invalid');
        }
        $host = preg_replace('~^(?:www|player)\\.~i', '', strtolower($data['host']));
        if (isset($this->services[$host])) {
            return $host;
        } else {
            if (isset($this->services['*.' . $host])) {
                return '*.' . $host;
            } else {
                if (!empty($this->wildCardHosts)) {
                    $trans = array('\\*' => '(?:.*)');
                    foreach ($this->wildCardHosts as $value) {
                        $regex = strtr(preg_quote($value, '~'), $trans);
                        if (preg_match('~' . $regex . '~i', $host)) {
                            return $value;
                        }
                    }
                }
            }
        }
        return $host;
    }