You are here

private function Uri::parseUri in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/Uri.php \Zend\Diactoros\Uri::parseUri()

Parse a URI into its parts, and set the properties

Parameters

string $uri:

1 call to Uri::parseUri()
Uri::__construct in vendor/zendframework/zend-diactoros/src/Uri.php

File

vendor/zendframework/zend-diactoros/src/Uri.php, line 433

Class

Uri
Implementation of Psr\Http\UriInterface.

Namespace

Zend\Diactoros

Code

private function parseUri($uri) {
  $parts = parse_url($uri);
  if (false === $parts) {
    throw new \InvalidArgumentException('The source URI string appears to be malformed');
  }
  $this->scheme = isset($parts['scheme']) ? $this
    ->filterScheme($parts['scheme']) : '';
  $this->userInfo = isset($parts['user']) ? $parts['user'] : '';
  $this->host = isset($parts['host']) ? $parts['host'] : '';
  $this->port = isset($parts['port']) ? $parts['port'] : null;
  $this->path = isset($parts['path']) ? $this
    ->filterPath($parts['path']) : '';
  $this->query = isset($parts['query']) ? $this
    ->filterQuery($parts['query']) : '';
  $this->fragment = isset($parts['fragment']) ? $this
    ->filterFragment($parts['fragment']) : '';
  if (isset($parts['pass'])) {
    $this->userInfo .= ':' . $parts['pass'];
  }
}