You are here

private static function Uri::createUriString in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-diactoros/src/Uri.php \Zend\Diactoros\Uri::createUriString()
  2. 8 vendor/guzzlehttp/psr7/src/Uri.php \GuzzleHttp\Psr7\Uri::createUriString()
Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/src/Uri.php \GuzzleHttp\Psr7\Uri::createUriString()

Create a URI string from its various parts

Parameters

string $scheme:

string $authority:

string $path:

string $query:

string $fragment:

Return value

string

2 calls to Uri::createUriString()
Uri::resolve in vendor/guzzlehttp/psr7/src/Uri.php
Resolve a base URI with a relative URI and return a new URI.
Uri::__toString in vendor/guzzlehttp/psr7/src/Uri.php
Return the string representation as a URI reference.

File

vendor/guzzlehttp/psr7/src/Uri.php, line 475

Class

Uri
Basic PSR-7 URI implementation.

Namespace

GuzzleHttp\Psr7

Code

private static function createUriString($scheme, $authority, $path, $query, $fragment) {
  $uri = '';
  if (!empty($scheme)) {
    $uri .= $scheme . '://';
  }
  if (!empty($authority)) {
    $uri .= $authority;
  }
  if ($path != null) {

    // Add a leading slash if necessary.
    if ($uri && substr($path, 0, 1) !== '/') {
      $uri .= '/';
    }
    $uri .= $path;
  }
  if ($query != null) {
    $uri .= '?' . $query;
  }
  if ($fragment != null) {
    $uri .= '#' . $fragment;
  }
  return $uri;
}