public static function parseUrl($url)
    {
        $info = parse_url($url);
        if (!$info || empty($info['scheme'])) {
            throw new InvalidUrl('The string must be a valid URL');
        }

        if (empty($info['scheme']) || !in_array($info['scheme'], array('http', 'https'))) {
            throw new InvalidUrl('Scheme must be one of http or https');
        }

        if (empty($info['port'])) {
            // Порт не указан
            $port = $info['scheme'] == 'https' ? 443 : 80;
        } else {
            $port = intval($info['port']);
        }

        return array(
            'scheme' => $info['scheme'],
            'host'   => $info['host'],
            'port'   => $port,
            'path'   => !empty($info['path']) ? trim($info['path'], '/') : '',
        );
    }