@param string $base
@param string $rel

@return string
350138
protected static function resolveRelativeUrlAfterEarlyChecks(string $base, string $rel): string
    {
        /* fix url file for Windows */
        $base = preg_replace('#^file:\/\/([^/])#', 'file:///\1', $base);

        /**
         * @var mixed[]
         *
         * parse base URL and convert to local variables:
         * $scheme, $host, $path
         */
        $parts = parse_url($base);

        return static::resolveRelativeUrlToAbsoluteUrl(
            $rel,
            (
                $rel[0] === '/'
                    ? ''  // destroy path if relative url points to root
                    : ( // remove non-directory element from path
                        isset($parts['path'])
                            ? preg_replace(
                                '#/[^/]*$#',
                                '',
                                (string) $parts['path']
                            )
                            : ''
                    )
            ),
            $parts
        );
    }
128489
public function rebase(string $base = null): self
    {
        $this->content = data_get($this->getOriginalContent(), $base);

        return $this;
    }
300329
public function getLink($rel, $absolute = true)
    {
        if ($this->hasLink($rel)) {
            return parent::getLink($rel, $absolute);
        }

        if ($rel === 'self') {
            return $this->getProperty('endpoint');
        }

        if ($rel === '#ui') {
            return $this->getProperty('uri');
        }

        if ($rel === '#manage-variables') {
            return $this->getUri() . '/variables';
        }

        return $this->getUri() . '/' . ltrim($rel, '#');
    }
926856
public function MarkupLink($rel, $href, $type = null, $sizes = null)
    {
        // start fragment
        $return = '<link rel="' . $rel . '" href="' . $href . '"';
        // if type
        if ($type !== null) {
            $return .= ' type="' . $type . '"';
        }
        // if sizes
        if ($sizes !== null) {
            $return .= ' sizes="' . $sizes . '"';
        }
        // end fragment
        $return .= ' />' . PHP_EOL;
        // return
        return $return;
    }
852859
protected function _base($base = null) {
		if ($base === null) {
			$base = preg_replace('/[^\/]+$/', '', $this->env('PHP_SELF'));
		}
		$base = trim(str_replace(["/app/webroot", '/webroot'], '', $base), '/');
		return $base ? '/' . $base : '';
	}
520575
public function add(string $rel, HttpUri $uri): Link
    {
        $link = new Link($rel, $uri);
        if (isset($this->links[$rel])) {
            if (!is_array($this->links[$rel])) {
                $this->links[$rel] = [$this->links[$rel]];
            }

            $this->links[$rel][] = $link;
        } else {
            $this->links[$rel] = $link;
        }

        return $link;
    }
1211565
public function gotoURL($url, $base = true)
    {
        if ($base) {
            $url = $this->app->baseURL . $url;
        }

        $this->js('location.href="'.$url.'";');
    }
842240
private static function findByRel(array $a, $rel)
    {
        $relName = mb_strtolower($rel, 'UTF-8');
        foreach ($a as $name => $value) {
            if (mb_strtolower($name, 'UTF-8') === $relName) {
                return $value;
            }
        }
        
        return null;
    }
980271
public function toBase(int $base) : string
    {
        if ($base === 10) {
            return $this->value;
        }

        if ($base < 2 || $base > 36) {
            throw new \InvalidArgumentException(\sprintf('Base %d is out of range [2, 36]', $base));
        }

        return Calculator::get()->toBase($this->value, $base);
    }
732556
protected function makeAbsoluteUrl($relativeUrl, $baseUrl = null)
    {
        $baseUrl = $baseUrl ?: $this->baseUrl;
        if (empty($baseUrl)) {
            throw new \RuntimeException('No base URL');
        }
        $base = \GuzzleHttp\Psr7\uri_for($baseUrl);

        return $base->withPath($relativeUrl)->__toString();
    }
1057303
public function getOperationByRel($rel, $single = true)
    {
        $operations = isset($this->object['operations']) ? $this->object['operations'] : [];
        $operation  = array_filter($operations, function ($value, $key) use ($rel) {
            return (is_array($value) && $value['rel'] === $rel);
        }, ARRAY_FILTER_USE_BOTH);

        if (count($operation) > 0) {
            $operation = array_shift($operation);

            return $single ? $operation['href'] : $operation;
        }

        return false;
    }
388458
private function getRelationIri($rel): string
    {
        if (!(\is_array($rel) || \is_string($rel))) {
            throw new UnexpectedValueException('Expected relation to be an IRI or array');
        }

        return \is_string($rel) ? $rel : $rel['_links']['self']['href'];
    }
1314137
private function applyBaseUrl(string $url): string
    {
        if ($this->baseUrl === null) {
            return $url;
        }

        if (substr($url, 0, 7) === "http://") {
            return $url;
        }

        if (substr($url, 0, 8) === "https://") {
            return $url;
        }

        $baseUrl = $this->baseUrl;

        if (substr($url, 0, 1) === "/") {
            $path = parse_url($baseUrl, \PHP_URL_PATH);
            if ($path !== null) {
                $baseUrl = substr($baseUrl, 0, strlen($path) * -1);
            }
        }

        return "{$baseUrl}/" . ltrim($url, "/");
    }
217596
public static function abs_url($url, $base)
    {
        if (!self::is_url_path($url)) {
            $t = is_array($base) ? $base : parse_url($base);
            if (strncmp($url, '//', 2) == 0) {
                if (!empty($t['scheme'])) {
                    $url = $t['scheme'] . ':' . $url;
                }
            } else {
                $base = (empty($t['scheme']) ? '//' : $t['scheme'] . '://') .
                    $t['host'] . (empty($t['port']) ? '' : ':' . $t['port']);
                if (!empty($t['path'])) {
                    $s = dirname($t['path'] . 'f');
                    if (DIRECTORY_SEPARATOR != '/') {
                        $s = strtr($s, DIRECTORY_SEPARATOR, '/');
                    }
                    if ($s && '.' !== $s && '/' !== $s && substr($url, 0, 1) !== '/') {
                        $base .= '/' . ltrim($s, '/');
                    }
                }
                $url = rtrim($base, '/') . '/' . ltrim($url, '/');
            }
        } else {
            $p = strpos($url, ':');
            if (substr($url, $p + 3, 1) === '/' && in_array(substr($url, 0, $p), array('http', 'https'))) {
                $url = substr($url, 0, $p + 3) . ltrim(substr($url, $p + 3), '/');
            }
        }
        return $url;
    }
856291
static function execute(Base $base)
    {

        self::$_base = $base;
        //first we separate the parameters
        $request = isset($_REQUEST['route']) ? $_REQUEST['route'] : '/';

        if(strpos($request,'?') > 0) {
            $split = explode('?',$request);
            $request = $split[0];
        }

        self::$_attr = array_slice(explode('/', trim($request, '/')), 2);

        self::_run($request);

        return self::$callback;
    }
816216
static function base($url = '', $cacheBuster = false) {
        $cacheb = $cacheBuster ? ('?' . (Config::get('app.version', '1.0.0'))) : ''; 
        $servern = $_SERVER['SERVER_NAME']; 
        $serverp = $_SERVER['SERVER_PORT'];
        $server = $serverp == '8080' || $serverp == '80' || $serverp == '443' ? $servern : "$servern:$serverp";

        return (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ||
                (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on'))
                    ? 'https://' : 'http://') . str_replace('//', '/', ($server . '/' . $url)) . $cacheb;
    }
400049
public static function absolutize($base, $relative)
	{
		if (!($relative instanceof SimplePie_IRI))
		{
			$relative = new SimplePie_IRI($relative);
		}
		if (!$relative->is_valid())
		{
			return false;
		}
		elseif ($relative->scheme !== null)
		{
			return clone $relative;
		}
		else
		{
			if (!($base instanceof SimplePie_IRI))
			{
				$base = new SimplePie_IRI($base);
			}
			if ($base->scheme !== null && $base->is_valid())
			{
				if ($relative->get_iri() !== '')
				{
					if ($relative->iuserinfo !== null || $relative->ihost !== null || $relative->port !== null)
					{
						$target = clone $relative;
						$target->scheme = $base->scheme;
					}
					else
					{
						$target = new SimplePie_IRI;
						$target->scheme = $base->scheme;
						$target->iuserinfo = $base->iuserinfo;
						$target->ihost = $base->ihost;
						$target->port = $base->port;
						if ($relative->ipath !== '')
						{
							if ($relative->ipath[0] === '/')
							{
								$target->ipath = $relative->ipath;
							}
							elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
							{
								$target->ipath = '/' . $relative->ipath;
							}
							elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
							{
								$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
							}
							else
							{
								$target->ipath = $relative->ipath;
							}
							$target->ipath = $target->remove_dot_segments($target->ipath);
							$target->iquery = $relative->iquery;
						}
						else
						{
							$target->ipath = $base->ipath;
							if ($relative->iquery !== null)
							{
								$target->iquery = $relative->iquery;
							}
							elseif ($base->iquery !== null)
							{
								$target->iquery = $base->iquery;
							}
						}
						$target->ifragment = $relative->ifragment;
					}
				}
				else
				{
					$target = clone $base;
					$target->ifragment = null;
				}
				$target->scheme_normalization();
				return $target;
			}

			return false;
		}
	}