@param UriInterface $uri

@return Content
@throws LoadException
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);
    }
1048625
private function parse($uri)
    {
        $this->parsedUri = parse_url($uri);

        if (false === strstr($this->parsedUri['path'], $this->config->getRootEndpoint())) {
            throw RestException::invalidEndpoint($this->parsedUri['path']);
        }

        $this->adjustRootEndpoint($this->parsedUri['path']);

        $this->parsedUri['path'] = str_replace($this->config->getRootEndpoint(), '', $this->parsedUri['path']);
        $this->parsePath($this->parsedUri['path']);

        $this->parsedUri['query'] = isset($this->parsedUri['query']) ? $this->parsedUri['query'] : '';
        $this->parseQueryString($this->parsedUri['query']);

        return $this;
    }
643241
protected function getContentConfigFile(UriInterface $url = null)
    {
        if (null !== $url) {
            $urlStr = (string)$url;
            $content = file_get_contents($urlStr);

            return $content;
        }

        $paths = static::getDefaultPathsToConfig();

        $content = null;
        foreach ($paths as $path) {
            $path = realpath($path);
            if ($path) {
                $filePath = $path . DIRECTORY_SEPARATOR . static::getConfigFileName();
                if (file_exists($filePath)) {
                    $content = file_get_contents($filePath);
                    break;
                }
            }
        }

        if (null === $content) {
            $errMsg = 'Не удалось прочитать конфигурационный файл';
            throw new FactoryException($errMsg);
        }

        return $content;
    }
761281
private function buildHost(UriInterface $uri): string
    {
        return $uri->getHost().($uri->getPort() !== null ? ':'.$uri->getPort() : '');
    }
1003181
public function internalRedirect($uri)
    {
        if (is_string($uri)) {

            // make a new URI instance, then make a new request
            $uri = $this->request->getUri()->withPath($uri);
            return $this->request->withUri($uri);

        } elseif ($uri instanceof UriInterface) {

            // get a new request with the specified URI instance
            return $this->request->withUri($uri);

        } else {

            // bad $uri value
            throw new InvalidArgumentException(
                'URI should be a string or instance of Psr\Http\Message\UriInterface'
            );

        }
    }
1205028
protected function injectApiVersionToUri(Url $uri)
    {
        $uri->setPath(str_replace('/{apiVersion}', $this->getApiVersionString(), '/' . urldecode($uri->getPath())));

        return $uri;
    }
352346
public static function createFromUri($uri)
    {
        foreach (static::$loaders as $loader) {
            if ($loader::canLoad($uri)) {
                return static::getLoader($loader);
            }
        }

        throw new FailedToLoadConfigException(
            sprintf(
                _('Could not find a suitable loader for URI "%1$s".'),
                $uri
            )
        );
    }
493597
public function toUri(): UriInterface
    {
        $str = $this::BASE_URL.$this->account->getPid().'/'.$this->player->getPid();

        if ($this->embed) {
            $str .= '/embed';
        }

        if ($this->byGuid) {
            $ownerId = $this->media->getOwnerId();
            $parts = explode('/', $ownerId);
            $numeric_id = end($parts);

            $uri = new Uri($str.'/select/media/guid/'.$numeric_id.'/'.$this->media->getGuid());
        } else {
            $uri = new Uri($str.'/select/media/'.$this->media->getPid());
        }

        $query_parts = [];

        // We use isset() so that if the values have never been explicitly set
        // the player configuration is used instead.
        if (isset($this->autoPlay)) {
            $query_parts['autoPlay'] = $this->autoPlay ? 'true' : 'false';
        }

        if (isset($this->playAll)) {
            $query_parts['playAll'] = $this->playAll ? 'true' : 'false';
        }

        $uri = $uri->withQuery(build_query($query_parts));

        return $uri;
    }
383996
protected function getEntityAttributesUri(string $entityId): UriInterface
    {
        $uri = $this->getEntityEndpointUri($entityId)->withPath(
            $this->getEntityEndpointUri($entityId) . '/attributes'
        );

        return $uri;
    }
95133
public static function uriWithArguments(UriInterface $uri, array $arguments): UriInterface
    {
        $query = http_build_query($arguments, '', '&', PHP_QUERY_RFC3986);
        return $uri->withQuery($query);
    }
1115562
protected function performRequest(string $uri)
    {
        $httpResponse = $this->client->get($uri);
        Assert::eq($httpResponse->getStatusCode(), 200, 'Request failed.');

        $content = $httpResponse->getBody()->getContents();
        $xml = simplexml_load_string($content);

        $this->exceptionOnError($xml);

        return $this->responseFactory->getResponse($xml);
    }
1297940
public function &findPageByUri($uri)
    {
        foreach ($this->getRootSection()->getSections() as $section) {
            if ($page = $section->findPageByUri($uri)) {
                return $page;
            }
        }

        return;
    }
760446
public function &findPageByUri($uri)
    {
        foreach ($this->getPages() as $page) {
            if ($page->getUrl() == $uri) {
                return $page;
            }
        }

        foreach ($this->getSections() as $section) {
            $found = $section->findPageByUri($uri);
            if (! is_null($found)) {
                return $found;
            }
        }

        return;
    }
799458
private function withServerPort(UriInterface $uri, array $server) : UriInterface {
		if (isset($server['SERVER_PORT'])) {
			return $uri->withPort($server['SERVER_PORT']);
		}

		return $uri;
	}
256001
public function getPath(UriInterface $uri)
    {
        $path  = trim($uri->getPath(), '/');
        $parts = explode('/', $path);

        if ($parts[0] === 'v'.Client::API_VERSION) {
            unset($parts[0]);
        }

        return '/'.implode('/', $parts);
    }
585534
private function sessionCookie(UriInterface $uri, string $id = null): Cookie
    {
        return Cookie::create(
            $this->config->getCookie(),
            $id,
            $this->config->getLifetime(),
            $this->httpConfig->basePath(),
            $this->httpConfig->cookieDomain($uri),
            $this->config->isSecure(),
            true
        );
    }
559327
protected function filterTrailingSlash(UriInterface $uri)
    {
        $path = $uri->getPath();

        if (strlen($path) > 1 && substr($path, -1) === '/') {
            $path = substr($path, 0, -1);
        }

        return $path;
    }