src/URI.php
public function getUri($start = self::SCHEME, $end = self::FRAGMENT)
	{
		$result = '';

		switch ($start) {
			default:
			case static::SCHEME:
				$scheme = $this->getScheme();

				if ($scheme) {
					$result .= $scheme . static::DELIMITER_SCHEME;
				}

				if ($end === static::SCHEME) {
					break;
				}

				// no break

			case static::AUTHORITY:
			case static::USERNAME:
				$username = $this->getUserInfo();

				if ($username && $this->getHost()) {
					$result .= static::DELIMITER_AUTHORITY . $username . static::DELIMITER_USER;
				}

				if ($end === static::USERNAME) {
					break;
				}

				// no break

			case static::HOST:
				$host = $this->getHost();

				if ($host && ($result === '' || !$this->getUserInfo())) {
					$result .= static::DELIMITER_AUTHORITY;
				}

				$result .= $host;

				if ($end === static::HOST) {
					break;
				}

				// no break

			case static::PORT:
				$port = $this->getPort();

				if ($port !== null && $this->getHost()) {
					$result .= static::DELIMITER_PORT . $port;
				}

				if ($end === static::PORT || $end === static::AUTHORITY) {
					break;
				}

				// no break

			case static::PATH:
			case static::DIRECTORY:
				$directory = $this->getDirectory();

				if ($result !== '' && $directory !== '' && substr($directory, 0, 1) !== static::DELIMITER_PATH) {
					$result .= static::DELIMITER_PATH;
				}

				$result .= $directory;

				if ($end === static::DIRECTORY) {
					break;
				}

				// no break

			case static::FILE:
				$file = $this->getFile();

				if ($result !== '' && substr($result, -1) !== static::DELIMITER_PATH && $file !== '') {
					$result .= static::DELIMITER_PATH;
				}

				$result .= $this->getFile();

				if ($end === static::FILE || $end === static::PATH) {
					break;
				}

				// no break

			case static::QUERY:
				$query = $this->getQuery();

				if ($query) {
					$result .= static::DELIMITER_QUERY . $query;
				}

				if ($end === static::QUERY) {
					break;
				}

				// no break

			case static::FRAGMENT:
				$fragment = $this->getFragment();

				if ($fragment) {
					$result .= static::DELIMITER_FRAGMENT . $fragment;
				}

				// no break
		}

		return $result;
	}
public function getUri($start = self::SCHEME, $end = self::FRAGMENT)
	{
		$result = '';

		switch ($start) {
			default:
			case static::SCHEME:
				$scheme = $this->getScheme();

				if ($scheme) {
					$result .= $scheme . static::DELIMITER_SCHEME;
				}

				if ($end === static::SCHEME) {
					break;
				}

				// no break

			case static::AUTHORITY:
			case static::USERNAME:
				$username = $this->getUserInfo();

				if ($username && $this->getHost()) {
					$result .= static::DELIMITER_AUTHORITY . $username . static::DELIMITER_USER;
				}

				if ($end === static::USERNAME) {
					break;
				}

				// no break

			case static::HOST:
				$host = $this->getHost();

				if ($host && ($result === '' || !$this->getUserInfo())) {
					$result .= static::DELIMITER_AUTHORITY;
				}

				$result .= $host;

				if ($end === static::HOST) {
					break;
				}

				// no break

			case static::PORT:
				$port = $this->getPort();

				if ($port !== null && $this->getHost()) {
					$result .= static::DELIMITER_PORT . $port;
				}

				if ($end === static::PORT || $end === static::AUTHORITY) {
					break;
				}

				// no break

			case static::PATH:
			case static::DIRECTORY:
				$directory = $this->getDirectory();

				if ($result !== '' && $directory !== '' && substr($directory, 0, 1) !== static::DELIMITER_PATH) {
					$result .= static::DELIMITER_PATH;
				}

				$result .= $directory;

				if ($end === static::DIRECTORY) {
					break;
				}

				// no break

			case static::FILE:
				$file = $this->getFile();

				if ($result !== '' && substr($result, -1) !== static::DELIMITER_PATH && $file !== '') {
					$result .= static::DELIMITER_PATH;
				}

				$result .= $this->getFile();

				if ($end === static::FILE || $end === static::PATH) {
					break;
				}

				// no break

			case static::QUERY:
				$query = $this->getQuery();

				if ($query) {
					$result .= static::DELIMITER_QUERY . $query;
				}

				if ($end === static::QUERY) {
					break;
				}

				// no break

			case static::FRAGMENT:
				$fragment = $this->getFragment();

				if ($fragment) {
					$result .= static::DELIMITER_FRAGMENT . $fragment;
				}

				// no break
		}

		return $result;
	}
Returns the URI with the given start and stop component.

@param string $start = self::SCHEME
@param string $end = self::FRAGMENT
@return string the URI.