@param string $uri

@return null|Page
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;
    }
142307
public static function parse($uri) {
		$uri = static::to(static::detectPathFrom(parse_url($uri, PHP_URL_PATH)));

		$query = array ();
		parse_str(parse_url($uri, PHP_URL_QUERY), $query);
		foreach ($query as $k => $v) {
			$uri->param($k, $v);
		}
		return $uri;
	}
969296
public function resolveAssetUri(string $uri): ?string
    {
        $targetObject = $this->convertUriToObject($uri);
        if ($targetObject === null) {
            $this->systemLogger->info(sprintf('Could not resolve "%s" to an existing asset; The asset was probably deleted.', $uri), LogEnvironment::fromMethodName(__METHOD__));
            return null;
        }
        return $this->resourceManager->getPublicPersistentResourceUri($targetObject->getResource());
    }
469578
protected function call($uri)
    {
        $request = Request::create($uri, 'GET');

        $kernel = $this->app->make(HttpKernel::class);

        $response = $kernel->handle($request);

        $kernel->terminate($request, $response);

        return $response;
    }
1085749
public static function parse(string $uri): Uri
    {
        preg_match(static::URI_PATTERN, $uri, $matches);

        $components = static::componentsFromMatches($matches);
        $scheme = $components['scheme'];
        $authority = $components['authority'];
        $path = $components['path'];
        $query = $components['query'];
        $fragment = $components['fragment'];

        return new static($path, $scheme, $authority, $query, $fragment);
    }
1017717
public function retrieve($uri)
    {
        $errorMessage = null;
        set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
            $errorMessage = $errstr;
        });
        $response = file_get_contents($uri);
        restore_error_handler();

        if ($errorMessage) {
            throw new ResourceNotFoundException($errorMessage);
        }

        if (false === $response) {
            throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
        }

        if ($response == ''
            && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
        ) {
            throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
        }

        $this->messageBody = $response;
        if (!empty($http_response_header)) {
            // $http_response_header cannot be tested, because it's defined in the method's local scope
            // See http://php.net/manual/en/reserved.variables.httpresponseheader.php for more info.
            $this->fetchContentType($http_response_header); // @codeCoverageIgnore
        } else {                                            // @codeCoverageIgnore
            // Could be a "file://" url or something else - fake up the response
            $this->contentType = null;
        }

        return $this->messageBody;
    }
1180762
public function getPrincipalByUri($uri)
    {
        $result = null;
        $collections = $this->principalCollectionSet;
        foreach ($collections as $collection) {
            try {
                $principalCollection = $this->server->tree->getNodeForPath($collection);
            } catch (NotFound $e) {
                // Ignore and move on
                continue;
            }

            if (!$principalCollection instanceof IPrincipalCollection) {
                // Not a principal collection, we're simply going to ignore
                // this.
                continue;
            }

            $result = $principalCollection->findByUri($uri);
            if ($result) {
                return $result;
            }
        }
    }
192461
protected function parse($uri)
	{
		// Set the original URI to fall back on
		$this->uri = $uri;

		/*
		 * Parse the URI and populate the object fields. If URI is parsed properly,
		 * set method return value to true.
		 */

		$parts = UriHelper::parse_url($uri);

		$retval = ($parts) ? true : false;

		// We need to replace &amp; with & for parse_str to work right...
		if (isset($parts['query']) && strpos($parts['query'], '&amp;'))
		{
			$parts['query'] = str_replace('&amp;', '&', $parts['query']);
		}

		$this->scheme   = isset($parts['scheme']) ? $parts['scheme'] : null;
		$this->user     = isset($parts['user']) ? $parts['user'] : null;
		$this->pass     = isset($parts['pass']) ? $parts['pass'] : null;
		$this->host     = isset($parts['host']) ? $parts['host'] : null;
		$this->port     = isset($parts['port']) ? $parts['port'] : null;
		$this->path     = isset($parts['path']) ? $parts['path'] : null;
		$this->query    = isset($parts['query']) ? $parts['query'] : null;
		$this->fragment = isset($parts['fragment']) ? $parts['fragment'] : null;

		// Parse the query
		if (isset($parts['query']))
		{
			parse_str($parts['query'], $this->vars);
		}

		return $retval;
	}
44511
public function getPage($url)
    {
        $pages = $this->getPages();
        $url = $this->normalizeUrl($url);

        if (!isset($pages[$url])) {
            return null;
        }


        $record = $pages[$url];

        foreach ($this->getEntities() as $entity) {
            if (strpos($record['filepath'], $entity->getPath()) !== false) {
                $page =  Injector::inst()->create(
                    $record['type'],
                    $entity,
                    $record['basename'],
                    $record['filepath']
                );

                return $page;
            }
        }
    }
161335
function makeUri($uri) {
      $a = parse_url($uri);

      if ( (isset($a['scheme'])) && (isset($a['host'])) ) {
        $this->url = $a;
      } else {
        unset($this->url['query']);
        unset($this->url['fragment']);
        $this->url = array_merge($this->url, $a);
      }

      if ($this->useProxy) {
        $requesturi = 'http://' . $this->url['host'] . (empty($this->url['port']) ? '' : ':' . $this->url['port']) . $this->url['path'] . (empty($this->url['query']) ? '' : '?' . $this->url['query']);
      } else {
        $requesturi = $this->url['path'] . (empty($this->url['query']) ? '' : '?' . $this->url['query']);
      }

      return $requesturi;
    }
682560
public function createRelative($uri = null)
    {
        if (empty($uri)) {
            // Empty uri means baseurl
            return $this->baseUrl;
        } elseif (substr($uri, 0, 7) == "http://"
            || substr($uri, 0, 8) == "https://"
            || substr($uri, 0, 2) == "//"
        ) {
            // Fully qualified, just leave as is.
            return rtrim($uri, '/');
        } elseif ($uri[0] == '/') {
            // Absolute url, prepend with siteUrl
            return rtrim($this->siteUrl . rtrim($uri, '/'), '/');
        }

        $uri = rtrim($uri, '/');
        return $this->baseUrl . '/' . $uri;
    }
610442
public function callStaticRoute($uri)
    {
        $params = array_slice($this->getUrlSegments(), 2);

        return $this->callController([$uri, $params]);
    }
1009622
protected function _normalizedUrl($uri)
    {
        $out = $uri->getScheme() . '://';
        $out .= strtolower($uri->getHost());
        $out .= $uri->getPath();

        return $out;
    }
364398
public static function sites(String $uri = NULL) : String
    {
        return str_replace(SSL_STATUS, Http::fix(true), self::site($uri));
    }
473718
public function getHttpClient( $uri = null )
    {
        $client = clone $this->httpClient;

        if ( $uri )
        {
            $client->setUri( $uri );
        }

        return $client;
    }
1133600
public static function sortQuery($uri)
    {
        return $uri->withQuery((string) (new Query(self::filterUri($uri)->getQuery()))->sort());
    }
887238
protected function httpGet($uri)
    {
        $results = [];
        // Start requesting at page 1
        $page = 1;
        // We dont know how many pages there are, so assume 1 until we know
        $pagecount = 1;
        while ($page <= $pagecount) {
            $this->log[] = [
                        'request' => [
                                    'method' => 'GET',
                                    'uri'    => $uri.'?page='.$page,
                                    ],
                        ];
            $response = \Httpful\Request::get($uri.'?page='.$page)
                                                    ->addHeader('X-Auth-Email', $this->email)
                                                    ->addHeader('X-Auth-Key', $this->apikey)
                                                    ->expectsType(\Httpful\Mime::JSON)
                                                    ->parseWith(function ($body) {
                                                        return \Metaclassing\Utility::decodeJson($body);
                                                    })
                                                    ->send()
                                                    ->body;
            $this->log[count($this->log) - 1]['response'] = $response;
            if ($response['success'] != true) {
                throw new \Exception("get {$uri} unsuccessful".\Metaclassing\Utility::encodeJson($response));
            }
            foreach ($response['result'] as $result) {
                array_push($results, $result);
            }
            // Now that we KNOW the pagecount, update that and increment our page counter
            $pagecount = $response['result_info']['total_pages'];
            // And get the next page ready for the next request
            $page++;
        }

        return $results;
    }