URL to parent brand stats.

@since 160625 Brand URLs.

@param string $uri URI to append.

@return string Output URL.
9102
public function toBrandParentStats(string $uri = ''): string
    {
        return $this->App->Parent ? $this->App->Parent->Utils->§BrandUrl->toBrandStats($uri) : $this->toBrandStats($uri);
    }
131806
public function analyseLink($linkUri)
    {
        $linkUri = '/' . ltrim($linkUri, '/');
        $siteAccessUri = "/$this->prefix" . $this->match() . $this->suffix;

        return $siteAccessUri . $linkUri;
    }
284519
protected function processUri($uri)
    {
        return preg_replace_callback('#\{([a-zA-Z0-9_,]*)\}#i', function ($matches) {
            return isset($this->tokens[$matches[1]]) ? $this->tokens[$matches[1]] : '';
        }, $uri);
    }
1374396
static public function escapeUri(string $uri): string {
        self::initSerializer();
        return self::$serializer->serialiseValue(new Resource($uri));
    }
617372
public function parse($uri)
    {
        preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);

        $components = array();
        if (5 < count($match)) {
            $components =  array(
                'scheme'    => $match[2],
                'authority' => $match[4],
                'path'      => $match[5]
            );
        }
        if (7 < count($match)) {
            $components['query'] = $match[7];
        }
        if (9 < count($match)) {
            $components['fragment'] = $match[9];
        }

        return $components;
    }
898508
public function analyseLink($linkUri)
    {
        // Joining slash between uriElements and actual linkUri must be present, except if $linkUri is empty.
        $joiningSlash = empty($linkUri) ? '' : '/';
        $linkUri = ltrim($linkUri, '/');
        $uriElements = implode('/', $this->getURIElements());

        return "/{$uriElements}{$joiningSlash}{$linkUri}";
    }
920000
public static function parse(string $uri): URI
    {
        if ($uri == '') {
            return new static();
        }

        $parts = parse_url($uri);
        if ($parts === false) {
            throw new \InvalidArgumentException(sprintf('Cannot parse malformed uri "%s".', $uri));
        }

        if (!isset($parts['scheme'])) {
            throw new \InvalidArgumentException(sprintf('Missing scheme in uri "%s".', $uri));
        }

        if (count($parts) == 1 && isset($parts['scheme'])) {
            throw new \InvalidArgumentException(sprintf('Missing hierarchical segment in uri "%s".', $uri));
        }

        $defaults = [
            'scheme' => '',
            'host' => '',
            'user' => '',
            'pass' => '',
            'port' => null,
            'path' => '',
            'query' => '',
            'fragment' => '',
        ];

        $parts = array_merge($defaults, $parts);

        return new static(
            $parts['scheme'],
            $parts['host'],
            $parts['path'],
            $parts['query'],
            $parts['fragment'],
            $parts['user'],
            $parts['pass'],
            $parts['port']
        );
    }
551428
public function get(string $uri)
    {
        $request = $this->getRequest($uri);

        return $this->send($request);
    }
364398
public static function sites(String $uri = NULL) : String
    {
        return str_replace(SSL_STATUS, Http::fix(true), self::site($uri));
    }
679294
public function asset($uri = null)
    {
        if (empty($uri)) {
            // Allow empty
        } 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 staticSiteUrl
            return rtrim($this->staticSiteUrl . rtrim($uri, '/'), '/');
        }

        $baseUrl = isset($this->staticBaseUrl)
            ? $this->staticBaseUrl
            : $this->baseUrl;

        return empty($uri)
            ? $baseUrl
            : $baseUrl . '/' . $uri;
    }
183346
public function uriToClassName(string $uri): string 
    {
        $string_parts = explode("-", $uri);
        $string = array_map('ucfirst', $string_parts);
        $string = implode("", $string) . "Controller"; 
        return preg_replace("/[^a-zA-Z0-9\-]/", "", $string);
    }
1081496
public function brandParentCdnArg(string $arg = ''): string
    {
        return $this->App->Parent ? $this->App->Parent->Utils->§BrandUrl->brandCdnArg($arg) : $this->brandCdnArg($arg);
    }
1171156
public function shortenUri($uri)
    {
        $cacheId = 'getPrefix_'.$uri;

        if (false == isset($this->cache[$cacheId])) {
            $longestNamespaceInfo = null;

            foreach ($this->namespaces as $ns => $nsUri) {
                // prefix found
                if (false !== \strpos($uri, $nsUri)) {
                    if (null == $longestNamespaceInfo) {
                        $longestNamespaceInfo = [
                            'ns' => $ns,
                            'nsUri' => $nsUri,
                        ];
                        continue;
                    }

                    // if we found a longer one
                    if (\strlen($nsUri) > \strlen($longestNamespaceInfo['nsUri'])) {
                        $longestNamespaceInfo = [
                            'ns' => $ns,
                            'nsUri' => $nsUri,
                        ];
                    }
                }
            }

            // prefer the prefix with the longest URI to avoid results like foo:bar/fff
            if (null !== $longestNamespaceInfo) {
                $this->cache[$cacheId] = \str_replace($longestNamespaceInfo['nsUri'], $longestNamespaceInfo['ns'].':', $uri);
            } else {
                $this->cache[$cacheId] = $uri;
            }
        }

        return $this->cache[$cacheId];
    }
227518
public function createUrl($uri = '/')
    {
        if (!isset($this->urlBase)) {
            $ssl = $this->isSSL();
            $protocol = 'http' . (($ssl) ? 's' : '');

            $host = $this->host;
            if (strpos($host, ':') === false) {
                $port = $this->serverData['SERVER_PORT'];
                $port = ((!$ssl && $port == '80') || ($ssl && $port == '443')) ? '' : ':' . $port;
                $host = $this->host . $port;
            }

            $this->urlBase = $protocol . '://' . $host;
        }

        if ($uri !== '' && strpos($uri, '/') === false) {
            $uri = '/' . $uri;
        }

        return $this->urlBase . $uri;
    }
1215218
public static function encodeUri($uri)
    {
        $uri = self::removeSchemeFromUri($uri, $scheme);
        $uri = rawurlencode($uri);

        // Decode slashes
        $uri = str_replace("%2F", "/", $uri);

        return $scheme . $uri;
    }
678260
protected function _uri_string($uri)
	{
		if ($this->item('enable_query_strings') == FALSE)
		{
			if (is_array($uri))
			{
				$uri = implode('/', $uri);
			}
			$uri = trim($uri, '/');
		}
		else
		{
			if (is_array($uri))
			{
				$i = 0;
				$str = '';
				foreach ($uri as $key => $val)
				{
					$prefix = ($i == 0) ? '' : '&';
					$str .= $prefix.$key.'='.$val;
					$i++;
				}
				$uri = $str;
			}
		}
	    return $uri;
	}
410175
protected function signUrl($uri) {
        $uri = '/' . $this->account . '/' . $uri;
        $time_str = $this->hmacTime($uri);
        $sign = $this->hmacSign($uri, $time_str);
        return $uri . $time_str . '&hmac_sign=' . $sign;
    }