{@inheritdoc}
@return URLImmutable
513561
public function removeParameter($name)
  {
    if ($this->isLocked()) {
      return $this->getObj()->removeParameter($name)->setLocked();
    } else {
      return parent::removeParameter($name);
    }
  }
954319
public function makeAbsolute($baseurl = null) {
        if (!$baseurl) return $this;
        if (!$baseurl instanceof Url) $baseurl = new static($baseurl);
        if ($this->is_url() && ($this->is_relative() || $this->is_host_relative() || $this->is_protocol_relative()) && $baseurl instanceof Url) {
            if (!$this->host) $this->host = $baseurl->getHost();
            $this->scheme = $baseurl->getScheme();
            $this->user = $baseurl->getUser();
            $this->pass = $baseurl->getPass();
            $this->port = $baseurl->getPort();
            $this->path = static::buildAbsolutePath($this->path, $baseurl->getPath());
        }
        return $this;
    }
1339114
public function getNormalizedHttpUrl()
    {
        $parts = parse_url($this->httpUrl);

        $port = @$parts['port'];
        $scheme = $parts['scheme'];
        $host = $parts['host'];
        $path = @$parts['path'];

        $port or $port = ($scheme == 'https') ? '443' : '80';

        if (($scheme == 'https' && $port != '443')
            || ($scheme == 'http' && $port != '80')
        ) {
            $host = "$host:$port";
        }
        return "$scheme://$host$path";
    }
660450
public function setFromUrl()
    {
        // Cache?
        $cacheRebuild = true;
        if ($this->options->cache) {
            $cacheKey = md5($this->get());
            $cacheData = $this->cache->get($cacheKey);

            if (!empty($cacheData)) {
                $cacheRebuild = false;
                $this->set($cacheData);
            }
        }

        // Get dom
        if ($cacheRebuild) {
            $dom = new \PHPHtmlParser\Dom;
            $dom->load($this->url, $this->PHPHtmlParserOptions);
            $element = $dom->find($this->selector)[0];

            if (!empty($element)) {
                // Filter?
                if (!empty($this->filter->selector)) {
                    $newElement = new \PHPHtmlParser\Dom;
                    $newElement->load($element->outerHtml, $this->PHPHtmlParserOptions);
                    $filter = $newElement->find($this->filter->selector);

                    if (!empty($filter)) {
                        $i = 0;
                        foreach ($filter as $item) {
                            if ($i >= $this->filter->length) {
                                $item->delete();
                            }
                            $i++;
                        }
                    }
                    unset($filter);

                    $html = $newElement->outerHtml;

                } else {
                    $html = $element->outerHtml;
                }

                $this->set($html);

                if ($this->options->cache && !empty($cacheKey)) {
                    $this->cache->set($cacheKey, $html);
                }
            }
        }

        return $this;
    }
411541
public function getUrlGenerator() {
		if ($this->urlGenerator === null) {
			$discovery = $this->getResourceDiscovery();
			$this->urlGenerator = $this->getPuliFactory()->createUrlGenerator($discovery);
		}

		return $this->urlGenerator;
	}
624098
public function getNormalizedUrl() {
		$parts = parse_url( $this->url );

		$scheme = isset( $parts['scheme'] ) ? $parts['scheme'] : 'http';
		$port = isset( $parts['port'] ) ?
			$parts['port'] : ( $scheme === 'https' ? '443' : '80' );
		$host = isset( $parts['host'] ) ? strtolower( $parts['host'] ) : '';
		$path = isset( $parts['path'] ) ? $parts['path'] : '';

		if ( ( $scheme === 'https' && $port != '443' ) ||
			( $scheme === 'http' && $port != '80' )
		) {
			$host = "{$host}:{$port}";
		}
		return "{$scheme}://{$host}{$path}";
	}
799544
public static function findUrlFactory()
    {
        try {
            $messageFactory = static::findOneByType(UriFactoryInterface::class);
        } catch (DiscoveryFailedException $e) {
            throw self::createException('url factory', $e);
        }

        return static::instantiateClass($messageFactory);
    }
713147
public function getUrl(): ?UrlGenerator
    {
        if (!$this->hasUrl()) {
            $this->setUrl($this->getDefaultUrl());
        }
        return $this->url;
    }
281321
private function formatUrl() {

		$jar 	= [];
		$query 	= $this -> url -> getQuery();

		if(null !== $query) {
			$jar[] = $query;
		}
		
		$query 	= '';

		if(count($this -> params) > 0 || count($jar) > 0) {

			if($this -> method === 'get') {
				
				foreach($this -> params as  $param) {

					$key  	= $param -> encode ? urlencode($param -> key) : $param -> key;
					$value 	= $param -> encode ? urlencode($param -> value) : $param -> value;

					$jar[] = sprintf('%s=%s', $key, $value);
				}
			}

			$query = '?' . implode('&', $jar);
		}

		return $this -> url -> generate(URLParser :: UNTIL_PATH) . $query;
	}
221964
public function put(ResourceObject $ro)
    {
        $ro->toString();
        $httpCache = $this->getHttpCacheAnnotation($ro);
        $cacheable = $this->getCacheableAnnotation($ro);
        ($this->setEtag)($ro, null, $httpCache);
        $lifeTime = $this->getExpiryTime($ro, $cacheable);
        if (isset($ro->headers['ETag'])) {
            $this->storage->updateEtag($ro, $lifeTime);
        }
        $this->setMaxAge($ro, $lifeTime);
        if ($cacheable instanceof Cacheable && $cacheable->type === 'view') {
            return $this->saveViewCache($ro, $lifeTime);
        }

        return $this->storage->saveValue($ro, $lifeTime);
    }
701813
public function getTransformId(): \Psr\Http\Message\UriInterface
    {
        if (!$this->transformId) {
            return new Uri();
        }

        return $this->transformId;
    }
819282
public function url($url)
    {
        if ($this->isNotSetOrEmpty($url)) {
            throw CouldNotCreateButton::urlNotProvided();
        } elseif (! filter_var($url, FILTER_VALIDATE_URL)) {
            throw CouldNotCreateButton::invalidUrlProvided($url);
        }

        $this->payload['url'] = $url;
        $this->isTypeWebUrl();

        return $this;
    }
1201759
private function prepare()
    {
        $constantParameters = $this->uriParser->predefinedParameters();
        array_map([$this, 'prepareConstant'], $constantParameters);

        $this->filter();
        $this->sort();

        return $this;
    }
1286089
private function getUrlFileSerializer()
    {
        if ($this->urlFileSerializer === null) {
            $this->urlFileSerializer = new UrlFileSerializer();
            $this->urlFileSerializer->setServiceLocator($this->getServiceLocator());
        }

        return $this->urlFileSerializer;
    }
686771
public function to($url)
    {
        $params = ['url' => (string) $url];
        $this->executor->execute(DriverCommand::GET, $params);

        return $this;
    }
901887
public static function create($uri)
    {
        if (($parse = parse_url($uri)) === false) {
            throw new \InvalidArgumentException('Unable to parse URI');
        }

        return new Uri(
            isset($parse[ 'scheme' ])
                ? $parse[ 'scheme' ]
                : '',
            isset($parse[ 'host' ])
                ? $parse[ 'host' ]
                : '',
            isset($parse[ 'path' ])
                ? $parse[ 'path' ]
                : '',
            isset($parse[ 'port' ])
                ? $parse[ 'port' ]
                : '',
            isset($parse[ 'query' ])
                ? $parse[ 'query' ]
                : '',
            isset($parse[ 'fragment' ])
                ? $parse[ 'fragment' ]
                : '',
            isset($parse[ 'user' ])
                ? $parse[ 'user' ]
                : '',
            isset($parse[ 'pass' ])
                ? $parse[ 'pass' ]
                : ''
        );
    }
1167129
public function getEmbedRestrictionId(): \Psr\Http\Message\UriInterface
    {
        if (!$this->embedRestrictionId) {
            return new Uri();
        }

        return $this->embedRestrictionId;
    }