Add protocol prefix if necessary (and possible)

@param string $url
@param string|null $prefix
@return string
514377
public static function autoPrefixUrl($url, $prefix = null) {
		if ($prefix === null) {
			$prefix = 'http://';
		}

		$pos = strpos($url, '.');
		if ($pos !== false) {
			if (strpos(substr($url, 0, $pos), '//') === false) {
				$url = $prefix . $url;
			}
		}
		return $url;
	}
970445
public function setPrefix($prefix)
    {
        $prefix = "/" . ltrim($prefix, "/");
        $routes = [];
        foreach ($this->routes as $route)
            $routes[] = $route->setPattern(rtrim($prefix . $route->getPattern(), "/"));
        $this->routes = $routes;
        return $this;
    }
681864
public function setPrefix($prefix, $field = null)
    {
        $param = $this->buildParam('facet.prefix', $field);
        return $this->set($param, $prefix);
    }
906756
public static function canonquery($query, $prefix = '')
    {
        parse_str(preg_replace('#^\?#', '', $query), $args);

        if (empty($args)) {
            return '';
        }

        ksort($args);
        return $prefix . http_build_query($args);
    }
1191319
protected function getPathBuilder($prefix)
    {
        return function ($value) use (&$prefix) {
            $prefix .= static::SEP_MAJOR . $this->fixString($value);
            return $prefix;
        };
    }
424204
public function endpointUrl($prefix = null, $includeId = true)
    {
        $url = self::API_URL;

        // push company id
        if ($includeId) {
            $url = $url .'/'. $this->getCompanyId();
        }

        // push prefix
        if ($prefix = trim($prefix, '/')) {
            $url = $url .'/'. $prefix;
        }

        return $url;
    }
867182
public static function addProtocolToUrl($url, $protocol = 'http')
    {
        $pattern = sprintf('/^%s.*/', $protocol);

        if ((bool)preg_match($pattern, $url)) {
            return $url;
        }

        return sprintf('%s://%s', $protocol, $url);
    }
472342
protected function requestRouteMatchesPrefix($prefix)
    {
        $prefixSegments = $this->splitPrefixSegments($prefix);
        $request = request();

        foreach ($prefixSegments as $index => $segment) {
            if (strtolower($request->segment($index + 1)) !== $segment) {
                return false;
            }
        }

        return true;
    }
1007296
public function url(string $url = null) : self
    {
        if (! $url) {
            $url = null;

            $httpHost = getenv('APP_URL'); // Has to start with a protocol - for example "http://"!

            if ($httpHost === false) {
                $url = 'http';

                // Quick and dirty
                if (isset($_SERVER['HTTPS'])) {
                    $url .= 's';
                }

                $url .= '://';

                $httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost/';
            }  

            $requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
            
            $safeRequestURI = htmlentities(strip_tags(urldecode($requestUri)));

            $url .= "{$httpHost}{$safeRequestURI}";
        } 

        if ($this->validate and ! filter_var($url, FILTER_VALIDATE_URL)) {
            throw new Exception("Open Graph: Invalid URL '{$url}'");
        }

        $this->forget('url');

        $this->tags[] = $this->createTag('url', $url);

        return $this;
    }
311770
protected function formatUrl($url)
    {
        $uri = !is_null($this->prefixUrl) ? $this->prefixUrl . $url : $url;

        return $uri == '/' ? '/' : ltrim(rtrim($uri, '/'), '/');
    }
566528
protected function checkPrefix($prefix)
    {
        if ($prefix === '' || $prefix === null || $prefix === false || $prefix < 0 || $prefix > $this->getMaxPrefix()) {
            throw new \InvalidArgumentException(sprintf(
                "Invalid IPv%s block prefix '%s'",
                $this->getVersion(),
                $prefix
            ));
        }
    }
12260
public function setPrefixUri($prefix)
	{
		//$prefix =  $this->normalizeUri($prefix);

		if (empty($prefix))
		{
			return $this;
		}

		$this->uri = $prefix .'/'. $this->uri;

		return $this;
	}
33404
function buildCommandPattern(string $prefix = null) {
        $pattern = '';
        if($prefix !== null) {
            $escapedPrefix = \preg_quote($prefix, '/');
            $pattern = '/^(<@!?'.$this->client->user->id.'>\s+(?:'.$escapedPrefix.'\s*)?|'.$escapedPrefix.'\s*)([^\s]+)/iu';
        } else {
            $pattern = '/^(<@!?'.$this->client->user->id.'>\s+)([^\s]+)/iu';
        }
        
        $this->commandPatterns[$prefix] = $pattern;
        
        $this->client->emit('debug', 'Built command pattern for prefix "'.$prefix.'": '.$pattern);
        return $pattern;
    }
959644
public function prefix($prefix = '') {
        if (empty($prefix) && null !== $prefix) {
            return $this->prefix;
        }
        else {
            $this->prefix = $prefix;
        }
    }
38323
public function setTagPrefix($prefix)
    {
        if(!is_string($prefix) && $prefix !== null)
        {
            throw new HTMLTagException("The tag prefix must be a string or null.");
        }

        $this->tag_prefix_previous = $this->getTagPrefix();
        $this->tag_prefix = $prefix;

        return $this;

    }
377683
public static String add(String prefix, String name) {
    return (prefix == null) ? name : prefix+"."+name;
  }
928378
public function prependRouteControllersWithPrefix($prefix)
    {
        foreach (parent::all() as $route) {
            $route->setDefault('_controller', $prefix.$route->getDefault('_controller'));
        }
    }