Builds a URI based on n array with the main components

@param array $components

@return string
495223
public function generate(array $components)
    {
        $uri = $components['scheme'] . '://'
             . $components['authority']
             . $components['path'];

        if (array_key_exists('query', $components) && strlen($components['query'])) {
            $uri .= '?' . $components['query'];
        }
        if (array_key_exists('fragment', $components)) {
            $uri .= '#' . $components['fragment'];
        }

        return $uri;
    }
808363
public function buildUriWithQuery($uri, array $params = [])
    {
        $uri = uri_for($uri);

        if (!Uri::isAbsolute($uri)) {
            $uri = $uri->withScheme($this->baseURL->getScheme())
                ->withUserInfo($this->baseURL->getUserInfo())
                ->withHost($this->baseURL->getHost())
                ->withPort($this->baseURL->getPort());
        }

        $default = [
            'username' => $this->username,
            'password' => $this->password,
        ];

        return $uri->withQuery(build_query(array_merge($default, $params)));
    }
55480
static protected function buildUrlSchemeHostPort(&$parts)
    {
        $return = '';
        if ($parts['scheme'] == 'omit') {
            $parts['scheme'] = null;
        } elseif (!$parts['scheme'] && !$parts['host']) {
            return '';
        } elseif (!$parts['scheme']) {
            // we passed a host, but no scheme
            if (\in_array($parts['host'], array(
                    '127.0.0.1',
                    'localhost',
                    isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : null,
            ))) {
                $local = true;
            } else {
                $regex = '#(.+\.)?(\w+.[a-z])$#';
                $hostDomain = \preg_replace($regex, '$1', $parts['host']);
                $localDomain = \preg_replace($regex, '$1', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null);
                $local = $hostDomain == $localDomain;
            }
            if ($local) {
                $parts['scheme'] = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on'
                    ? 'https'
                    : 'http';
            } else {
                $parts['scheme'] = 'http';
            }
        } elseif (!\in_array($parts['scheme'], array('http','https'))) {
            $parts = \array_diff_key($parts, \array_flip(array('query','fragment','params')));
        }
        if ($parts['scheme']) {
            $return .= $parts['scheme'].':';
        }
        if ($parts['host']) {
            $return .= '//';
            $parts = \array_merge(array('user'=>null,'pass'=>null), $parts);
            if (!empty($parts['user'])) {
                $return .= $parts['user'].\rtrim(':'.$parts['pass'], ':').'@';
            }
            $return .= $parts['host'];
            if ($parts['port']) {
                $defaultPorts = array(
                    'http' => 80,
                    'https' => 443,
                );
                if ($parts['scheme']) {
                    if (isset($defaultPorts[ $parts['scheme'] ]) && $parts['port'] == $defaultPorts[ $parts['scheme'] ]) {
                        $parts['port'] = null;
                    }
                } elseif (in_array($parts['port'], $defaultPorts)) {
                    $parts['port'] = null;
                }
                $return .= \rtrim(':'.$parts['port'], ':');
            }
        }
        return $return;
    }
794673
public static function getComponentNs(string $component): string
    {
        if ($component === 'framework') {
            return '';
        }

        $namespace = '';
        $nsAry = explode('-', $component);
        foreach ($nsAry as $ns) {
            $namespace .= "\\" . ucfirst($ns);
        }

        return $namespace;
    }
872675
private function getComponentXml(array $components)
    {
        $componentXml = '';
        foreach ($components as $component) {
            $componentXml .= $component->asXml();
        }
        return $componentXml;
    }
61761
final public function createClazzFromStringArray(array $parts) : Dependency
    {
        try {
            $clazz = new Clazz(
                $this->extractClazzPart($parts),
                new Namespaze($this->extractNamespaceParts($parts))
            );
        } catch (\InvalidArgumentException $exception) {
            $clazz = new NullDependency();
        }
        return $clazz;
    }
711839
protected function buildUrl(array $segments = [])
    {
        //Get the base URL and add a ?
        $url = $this->apiBase.'?';

        if (isset($this->apiEnding)) {
            $segments = array_merge($segments, $this->apiEnding);
        }

        foreach ($segments as $key => $value) {
            $url = $url."$key=$value&";
        }

        //Remove the final &
        $url = substr($url, 0, -1);

        return $url;
    }
813681
public static function assembleUrl ($parts) {
    $url = '';
    if (isset($parts['scheme'])) {
      $url .= "{$parts['scheme']}:";
    }
    $url .= '//';
    if (isset($parts['user'])) {
      $url .= $parts['user'];
      if (isset($parts['password'])) {
        $url .= ":{$parts['password']}";
      }
      $url .= '@';
    }
    if (isset($parts['host'])) {
      $url .= $parts['host'];
    }
    if (isset($parts['port'])) {
      $url .= ":{$parts['port']}";
    }
    if (isset($parts['path'])) {
      $url .= $parts['path'];
    }
    if (isset($parts['query'])) {
      $url .= "?{$parts['query']}";
    }
    if (isset($parts['fragment'])) {
      $url .= "#{$parts['fragment']}";
    }
    return $url;
  }
1072308
public function build(array $arguments = [])
    {
        $arguments = Arrays::arrayMergeRecursiveOverrule($this->arguments, $arguments);
        $arguments = $this->mergeArgumentsWithRequestArguments($arguments);

        $httpRequest = $this->request->getHttpRequest();

        $uriPathPrefix = $this->environment->isRewriteEnabled() ? '' : 'index.php/';
        $uriPathPrefix = $httpRequest->getScriptRequestPath() . $uriPathPrefix;
        $resolveContext = new ResolveContext($httpRequest->getBaseUri(), $arguments, $this->createAbsoluteUri, $uriPathPrefix);
        $resolvedUri = $this->router->resolve($resolveContext);
        if ($this->section !== '') {
            $resolvedUri = $resolvedUri->withFragment($this->section);
        }

        $this->lastArguments = $arguments;
        return (string)$resolvedUri;
    }
1273127
final protected function buildUrl($fragments)
    {
        // Verify url path
        if (!isset($fragments[0])) {
            throw new InvalidFragmentsParameter('Invalid base url structure, http:// path must exists at position [0]', 1);
        }

        // Cleaning up
        $url = $fragments[0];
        unset($fragments[0]);

        // Begin process for make replacements
        if (isset($fragments[1]) && is_array($fragments[1])) {
            $replacements = [];
            $params = $fragments[1];

            // Add { } to each element of the array
            array_walk($params, function (&$item, $key) use (&$replacements) {
                $replacements['{'.$key.'}'] = $item;
            });
        }

        return str_replace(array_keys($replacements), array_values($replacements), $url);
    }
827631
public function build(array $strings)
	{
		$strings = array_unique($strings);
		sort($strings);
		if ($this->isEmpty($strings))
		{
			return '';
		}

		$strings = $this->splitStrings($strings);
		$strings = $this->meta->replaceMeta($strings);
		$strings = $this->runner->run($strings);

		return $this->serializer->serializeStrings($strings);
	}
83000
public static function createFromParse(array $parts)
    {
        $uri = new static();
        if (isset($parts['schema'])) {
            $uri->scheme = UriFilter::scheme($parts['schema']);
        }
        if (isset($parts['host'])) {
            $uri->host = UriFilter::host($parts['host']);
        }
        if (isset($parts['port'])) {
            $uri->port = UriFilter::port($parts['port']);
        }
        if (isset($parts['path'])) {
            $uri->path = UriFilter::path($parts['path']);
        }
        if (isset($parts['query'])) {
            $uri->query = UriFilter::body($parts['query']);
        }
        if (isset($parts['fragment'])) {
            $uri->fragment = UriFilter::body($parts['fragment']);
        }
        if (isset($parts['user'])) {
            $uri->userInfo = $parts['user'];
        }
        if (isset($parts['pass'])) {
            $uri->userInfo .= ':' . $parts['pass'];
        }
        $uri->validate();
        return $uri;
    }
1094536
final public function createAbstractClazzFromStringArray(array $parts) : AbstractClazz
    {
        return new AbstractClazz(
            $this->extractClazzPart($parts),
            new Namespaze($this->extractNamespaceParts($parts))
        );
    }
1215835
public static function build($component, array $options = [])
    {
        if (is_array($component)) {
            return implode(', ', $component);
        }

        return $component->old . ' TO ' . $component->new;
    }
938178
protected static function buildUrlMergeUrlParts($parts)
    {
        $partsDefault = array(
            'scheme'    => null,
            'host'      => null,
            'port'      => null,
            'path'      => '/',
            'query'     => '',
            'fragment'  => null,
        );
        if (!empty($parts['url'])) {
            $urlParts = self::parseUrl(htmlspecialchars_decode($parts['url']));
            if (!$urlParts['scheme']) {
                $urlParts['scheme'] = 'omit';
            }
            if (!empty($parts['path'])) {
                // discard url's query and fragment
                $urlParts['query']      = null;
                $urlParts['params']     = array();
                $urlParts['fragment']   = null;
            }
            if ($urlParts['query'] && !empty($parts['query'])) {
                // merge the queries
                $paramsParts = Str::parse($parts['query']);
                $params = ArrayUtil::mergeDeep($urlParts['params'], $paramsParts);
                $parts['query'] = self::buildQueryString($params);
            }
            $partsDefault = array_merge($partsDefault, $urlParts);
        }
        $parts = array_merge($partsDefault, $parts);
        return $parts;
    }
767279
public static function build($component, array $options = [])
    {
        if (is_array($component)) {
            return "(\n  " . implode(",\n  ", $component) . "\n)";
        }

        $tmp = '';

        if ($component->isConstraint) {
            $tmp .= 'CONSTRAINT ';
        }

        if (isset($component->name) && ($component->name !== '')) {
            $tmp .= Context::escape($component->name) . ' ';
        }

        if (! empty($component->type)) {
            $tmp .= DataType::build(
                $component->type,
                ['lowercase' => true]
            ) . ' ';
        }

        if (! empty($component->key)) {
            $tmp .= $component->key . ' ';
        }

        if (! empty($component->references)) {
            $tmp .= 'REFERENCES ' . $component->references . ' ';
        }

        $tmp .= $component->options;

        return trim($tmp);
    }
982386
public function withArray(array $parts = null)
	{	//	WARNING: Cannot use ?? because we might want to set some parts explicity to null, eg. ['fragment' => null]
		//	UPDATE: we could do this: ['fragment' => '']
		$new = new static();
		$new->scheme	=	isset($parts['scheme'])		?	$parts['scheme']	:	$this->_scheme;
		$new->user		=	isset($parts['user'])		?	$parts['user']		:	$this->_user;
		$new->pass		=	isset($parts['pass'])		?	$parts['pass']		:	$this->_pass;
		$new->host		=	isset($parts['host'])		?	$parts['host']		:	$this->_host;
		$new->port		=	isset($parts['port'])		?	$parts['port']		:	$this->_port;
		$new->path		=	isset($parts['path'])		?	$parts['path']		:	$this->_path;
		$new->query		=	isset($parts['query'])		?	$parts['query']		:	$this->_query;
		$new->fragment	=	isset($parts['fragment'])	?	$parts['fragment']	:	$this->_fragment;
		return $new;
	}