public static function createFromArray(array $arr)
    {
        $ret = new Url;
        $keys = ['scheme','user','pass','host','port','path','query','fragment'];
        foreach ($keys as $key) {
            if (array_key_exists($key, $arr)) {
                $fn = 'set'.ucfirst($key);
                call_user_func([$ret, $fn], $arr[$key]);
            }
        }
        return $ret;
    }