/** * Normalizes an url. * * @param string|object $url The url. * * @throws HttpAdapterException If the url is not valid. * * @return string The normalized url. */ public static function normalize($url) { $url = (string) $url; if (($parts = parse_url($url)) === false || !isset($parts['scheme']) || !isset($parts['host'])) { throw HttpAdapterException::urlIsNotValid($url); } return $url; }