Set the base URI.

@param \Psr\Http\Message\UriInterface $uri

@return \Risan\OAuth1\Config\UriConfig

@throws \InvalidArgumentException
436672
public function setBase(UriInterface $uri)
    {
        if (! $this->parser->isAbsolute($uri)) {
            throw new InvalidArgumentException('The base URI must be absolute.');
        }

        $this->base = $uri;

        return $this;
    }
1096094
public function validateSocketUri($uri)
    {
        $uri = (string)$uri;
        if (!$uri) {
            throw new InvalidArgumentException('Invalid URI');
        }

        $scheme = parse_url($uri, PHP_URL_SCHEME);
        $scheme = $this->validateScheme($scheme);

        $host = parse_url($uri, PHP_URL_HOST);
        if (!$host) {
            throw new InvalidArgumentException("Invalid host");
        }

        $port = parse_url($uri, PHP_URL_PORT);
        if (!$port) {
            $port = $this->getPort($scheme);
        }

        return [$scheme, $host, $port];
    }
345991
public function load(UriInterface $uri)
    {
        if (!$uri instanceof HttpUriInterface) {
            throw new InvalidUriTypeException(
                $uri,
                'Eloquent\Schemer\Uri\HttpUriInterface'
            );
        }
        if (!$uri->isAbsolute()) {
            throw new RelativeUriException($uri);
        }

        $response = $this->browser()->get($uri->toString());
        if (!$response->isSuccessful()) {
            throw new LoadException($uri);
        }

        $mimeType = $this->mimeTypeByResponse($response);
        if (null === $mimeType) {
            $mimeType = $this->extensionMap()->getByPath(
                $this->pathFromUri($uri)
            );
        }

        return new Content($response->getContent(), $mimeType);
    }
733723
public function withUri(UriInterface $uri, $preserveHost = false)
    {
        if ($this->getUri() === $uri) {
            return $this;
        }

        $newInstance = clone $this;

        $newInstance->setUri($uri);
        if (!$preserveHost) {
            return $newInstance->withHeader('host', $uri->getHost());
        }
        return $newInstance;
    }
689731
protected function updateOptions(UriInterface $uri)
    {
        $query = $this->options['query'];
        if ($this->options['reuseParams']) {
            $query = array_merge(
                $query,
                $this->request->getQueryParams()
            );
        }
        $queryString = http_build_query($query);
        $uri = $uri->withQuery($queryString);
        return $this->updateHostName($uri);
    }
956241
private function replaceHostHeader(UriInterface $uri)
    {
        $host = $uri->getHost();

        if (!empty($host)) {

            $port = $uri->getPort();
            if (!empty($port)) {
                $host .= ':' . $port;
            }

            //~ Ensure Host is the first header. See: http://tools.ietf.org/html/rfc7230#section-5.4
            $this->headersOriginal = ['Host' => [$host]] + $this->headersOriginal;
            $this->headers         = ['host' => [$host]] + $this->headers;
        }
    }
282829
public static function createFromString(string $uri): self
    {
        if (!\is_string($uri) && !\method_exists($uri, '__toString')) {
            throw new \InvalidArgumentException('Uri must be a string');
        }

        $parts    = \parse_url($uri);
        $scheme   = $parts['scheme'] ?? '';
        $user     = $parts['user'] ?? '';
        $pass     = $parts['pass'] ?? '';
        $host     = $parts['host'] ?? '';
        $port     = $parts['port'] ?? null;
        $path     = $parts['path'] ?? '';
        $query    = $parts['query'] ?? '';
        $fragment = $parts['fragment'] ?? '';

        return new static($scheme, $host, $port, $path, $query, $fragment, $user, $pass);
    }
1235420
public function createUrlFromUri($uri)
    {
        $uri = ltrim($uri, '/');

        return empty($this->baseUrl)
            ? $this->app[\Illuminate\Contracts\Routing\UrlGenerator::class]->to($uri)
            : $this->baseUrl.$uri;
    }
1372912
public function setUrl($url)
    {
        if (!is_null($url) && !$url instanceof KHttpUrl) {
            throw new InvalidArgumentException('Invalid url type.');
        }

        $this->url = $url;
        return $this;
    }
482348
public function setUri($uri)
    {
        if (!is_array($uri)) {
            $uri = parse_url($uri);
        }

        $this->uri = $uri;
        return $this;
    }
1032505
public static function resolve(Uri $baseUri, Uri $targetUri)
    {
        if (!$baseUri->isAbsolute()) {
            throw new InvalidArgumentException('Base uri must be absolute');
        }

        // if the target uri is absolute
        if ($targetUri->isAbsolute()) {
            $path = $targetUri->getPath();

            if (!empty($path)) {
                return $targetUri->withPath($path);
            } else {
                return $targetUri;
            }
        } else {
            $authority = $targetUri->getAuthority();
            $path      = $targetUri->getPath();
            $query     = $targetUri->getQuery();

            if (!empty($authority)) {
                if (!empty($path)) {
                    $path = self::removeDotSegments($path);
                }
            } else {
                if (empty($path)) {
                    if (empty($query)) {
                        $path  = $baseUri->getPath();
                        $query = $baseUri->getQuery();
                    } else {
                        $path = self::merge($baseUri->getPath(), '');
                    }
                } else {
                    if (substr($path, 0, 1) == '/') {
                        $path = self::removeDotSegments($path);
                    } else {
                        $path = self::merge($baseUri->getPath(), $path);
                        $path = self::removeDotSegments($path);
                    }
                }

                $authority = $baseUri->getAuthority();
            }

            return new Uri(
                $baseUri->getScheme(),
                $authority,
                $path,
                $query,
                $targetUri->getFragment()
            );
        }
    }
109091
public function resolve(UriInterface $uri): UriInterface
    {
        $request = new Request('GET', $uri);
        $lastRequestUri = $request->getUri();
        $requestUri = new Uri('');

        try {
            $response = $this->httpClient->send($request, [
                'on_stats' => function (TransferStats $stats) use (&$requestUri) {
                    if ($stats->hasResponse()) {
                        $requestUri = $stats->getEffectiveUri();
                    }
                },
            ]);
        } catch (TooManyRedirectsException $tooManyRedirectsException) {
            return $requestUri;
        } catch (BadResponseException $badResponseException) {
            $response = $badResponseException->getResponse();
        }

        if ($this->followMetaRedirects) {
            $metaRedirectUri = $this->getMetaRedirectUriFromResponse($response, $lastRequestUri);

            if (!empty($metaRedirectUri) && !$this->isLastResponseUrl($metaRedirectUri, $lastRequestUri)) {
                return $this->resolve($metaRedirectUri);
            }
        }

        return $requestUri;
    }
1192816
public function setUrl($url)
    {
        if (!is_null($url)) {
            if (!preg_match('@^https?://@', $url)) {
                throw new \InvalidArgumentException(sprintf('Invalid url: %s', $url));
            }

            $this->url = $url;
        } else {
            $this->url = null;
        }

        return $this;
    }
527889
public function withUri(UriInterface $uri, $preserveHost = false)
        {
            $clone = clone $this;
            $clone->uri = $uri;
            $host = $uri->getHost();

            if (!$preserveHost) {
                $clone->headers['host'] = $this->setNotPreserveHost($host);
            } else {

                $headerHost = $this->getHeaderLine('Host');
                $clone->headers['host'] = $this->setPreserveHost($headerHost, $host);

            }
            return $clone;
        }
239532
public function applyToUri(UriInterface $uri)
    {
        $query = array_replace(self::parse($uri->getQuery()), $this->data);

        return $uri->withQuery(self::build($query));
    }
784094
public function setBaseUrl($uri)
    {
        if (is_string($uri)) {
            $this->baseUrl = Uri::createFromString($uri);
        } else {
            $this->baseUrl = $uri;
        }
        return $this;
    }
1136458
public function load(UriInterface $uri)
    {
        if (!$uri instanceof DataUriInterface) {
            throw new InvalidUriTypeException(
                $uri,
                'Eloquent\Schemer\Uri\DataUriInterface'
            );
        }

        return new Content(
            $uri->getData(),
            $this->stripMimeTypeParameters($uri->getMimeType())
        );
    }