Builds error message for invalid url.

@throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If given $scheme is not supported.

@param string $scheme
@param string $target
@param string|null $anchorName
@return string
481047
protected function getInvalidLinkError($scheme, $target, $anchorName = null)
    {
        $url = "$scheme://$target" . ($anchorName ? '#' . $anchorName : '');

        switch ($scheme) {
            case 'eznode':
                return sprintf('Invalid link "%s": target node cannot be found', $url);
            case 'ezobject':
                return sprintf('Invalid link "%s": target object cannot be found', $url);
            default:
                throw new InvalidArgumentException($scheme, "Given scheme '{$scheme}' is not supported.");
        }
    }
1367025
static function createUriString($scheme, $authority, $path, $query, $fragment) {
        $uri = '';
        if (!empty($scheme)) {
            $uri .= $scheme . ':';
        }
        $hierPart = '';
        if (!empty($authority)) {
            if (!empty($scheme)) {
                $hierPart .= '//';
            }
            $hierPart .= $authority;
        }
        if ($path != null) {
            // Add a leading slash if necessary.
            if ($hierPart && substr($path, 0, 1) !== '/') {
                $hierPart .= '/';
            }
            $hierPart .= $path;
        }
        $uri .= $hierPart;
        if ($query != null) {
            $uri .= '?' . $query;
        }
        if ($fragment != null) {
            $uri .= '#' . $fragment;
        }
        return $uri;
    }
142154
function link($target, $link)
    {
        $this->files->ensureDirExists(
            $linkPath = $this->sitesPath(), user()
        );

        $this->config->prependPath($linkPath);

        $this->files->symlinkAsUser($target, $linkPath.'/'.$link);

        return $linkPath.'/'.$link;
    }
512244
public static function toTarget(Certificate $target,
        CertificateBundle $trust_anchors, CertificateBundle $intermediate = null): self
    {
        $builder = new CertificationPathBuilder($trust_anchors);
        return $builder->shortestPathToTarget($target, $intermediate);
    }
1069598
private function filterScheme(string $scheme): string
    {
        $result = strtolower($scheme);
        if (isset(self::$knownPorts[$result])) {
            return $result;
        }

        $result = preg_replace('#:(//)?$#', '', $result);
        if (!preg_match('#^[a-z][a-z0-9\+\-\.]*$#i', $result)) {
            throw new \InvalidArgumentException(sprintf('Invalid scheme "%s".', $scheme));
        }

        return $result;
    }
858819
public function get($args = [], $scheme = false)
    {
        if (is_string($args)) {
            $url = $args;
            if ($url === '') {
                return $this->router->createUrl($url, $scheme);
            } elseif ($url[0] === '/') {
                $url = $this->alias->get('@web') . $url;
                if (!$scheme) {
                    return $url;
                }
            } elseif (parse_url($url, PHP_URL_SCHEME)) {
                return $url;
            } else {
                return $this->router->createUrl($url, $scheme);
            }
            $anchor = null;
            $args = '';
        } else {
            $url = $args[0];
            if ($url === '') {
                return $this->router->createUrl($args, $scheme);
            } elseif ($url[0] === '/') {
                $url = $this->alias->get('@web') . $url;
            } elseif (parse_url($url, PHP_URL_SCHEME)) {
                null;
            } else {
                return $this->router->createUrl($args, $scheme);
            }

            $anchor = isset($args['#']) ? $args['#'] : null;
            unset($args[0], $args['#']);
        }

        if ($args) {
            $url .= (strpos($url, '?') !== false ? '&' : '?') . http_build_query($args);
        }

        if ($anchor !== null) {
            $url .= '#' . $anchor;
        }

        if ($scheme) {
            if ($scheme === true) {
                $scheme = $this->request->getScheme();
            }
            return ($scheme === '//' ? $scheme : "$scheme://") . $this->request->getServer('HTTP_HOST') . $url;
        } else {
            return $url;
        }
    }
856727
public function siteHref(string $site, string $controller = null, string $action = null, array $params = null, string $lang = null): string
    {
        if ($controller !== null && strpos($controller, '/') !== false) {
            throw new \InvalidArgumentException('Slash is not allowed in controller name');
        }

        if ($action !== null && strpos($action, '/') !== false) {
            throw new \InvalidArgumentException('Slash is not allowed in action name');
        }

        if ($controller === null) {
            $controller = '';
        }

        if ($site !== '') {
            // we're building link to another server
            $otherSite = Application::getConfig('sites')->get($site);
            if ($otherSite !== null) {
                $url = $otherSite;
            } else {
                Log::warning('Missing sites definition key \'' . $site . '\'; please define it in your sites.php config');
                $url = Application::getDomainWithSchema();
            }
        } else {
            $url = Application::getDomainWithSchema();
        }

        $url .= '/' . $controller;

        if ($action !== null) {
            $url .= '/' . $action;
        }

        if ($params !== null && count($params) > 0) {
            $q = [];
            foreach ($params as $key => $value) {
                if (is_numeric($key)) {
                    $url .= '/' . $value;
                } else {
                    $q[$key] = $value;
                }
            }

            if (sizeof($q) > 0) {
                $url .= '?';
                foreach ($q as $key => $value) {
                    $url .= "{$key}={$value}&";
                }
                $url = substr($url, 0, -1);
            }
        }

        return $url;
    }
157620
public function addOrReplaceTarget($targetName, &$target)
    {
        $this->log("  +Target: $targetName", Project::MSG_DEBUG);
        $target->setProject($this);
        $this->targets[$targetName] = $target;

        $ctx = $this->getReference(ProjectConfigurator::PARSING_CONTEXT_REFERENCE);
        $current = $ctx->getCurrentTargets();
        $current[$targetName] = $target;
    }
1270137
private function normalizeScheme($scheme)
    {
        if (!is_string($scheme) && !method_exists($scheme, '__toString')) {
            throw new InvalidArgumentException('Uri scheme must be a string');
        }

        $scheme = str_replace('://', '', strtolower((string) $scheme));
        if (!isset($this->validSchema[$scheme])) {
            throw new InvalidArgumentException('Uri scheme must be one of: "", "https", "http"');
        }

        return $scheme;
    }
87272
protected function setScheme($scheme)
    {
        $scheme = strtolower($scheme);
        
        if ($scheme !== '' && !$this->isSupportedScheme($scheme)) {
            throw new \InvalidArgumentException("Invalid or unsupported scheme '$scheme'");
        }
        
        $this->scheme = $scheme;
    }
1359507
public function asLink($href=NULL,$target=NULL) {
		if (isset($href))
			$this->setProperty("href", $href);
		if(isset($target))
			$this->setProperty("target", $target);
		return $this->setTagName("a");
	}
1354085
protected function filterScheme($scheme)
    {
        $scheme = rtrim(strtolower($scheme), ':/');

        if (!preg_match('/^[a-z][a-z0-9.+-]*$/i', $scheme)) {
            throw new InvalidArgumentException('Scheme "%s" invalid or unsupported.', $scheme);
        }

        return $scheme;
    }
491040
protected function filterScheme($scheme)
    {
        $scheme = strtolower($scheme);
        $scheme = preg_replace('#:(//)?$#', '', $scheme);

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

        if (!array_key_exists($scheme, $this->allowedSchemes)) {
            throw new InvalidArgumentException(sprintf(
                'Unsupported scheme "%s"; must be any empty string or in the set (%s)',
                $scheme,
                implode(', ', array_keys($this->allowedSchemes))
            ));
        }

        return $scheme;
    }
421749
protected function getRedirectUrl($target, ServerRequestInterface $request)
    {
        $param = $this->getConfig('queryParam');
        if ($param === null) {
            return $target;
        }

        $uri = $request->getUri();
        if (property_exists($uri, 'base')) {
            $uri = $uri->withPath($uri->base . $uri->getPath());
        }
        $query = urlencode($param) . '=' . urlencode($uri);

        $url = parse_url($target);
        if (isset($url['query']) && strlen($url['query'])) {
            $url['query'] .= '&' . $query;
        } else {
            $url['query'] = $query;
        }
        $fragment = isset($url['fragment']) ? '#' . $url['fragment'] : '';

        return $url['path'] . '?' . $url['query'] . $fragment;
    }
137018
private function createResourceLocatorUrl($scheme, $portalUrl, $resourceLocator)
    {
        if (false !== strpos($portalUrl, '/')) {
            // trim slash when resourceLocator is not domain root
            $resourceLocator = rtrim($resourceLocator, '/');
        }

        return rtrim(sprintf('%s://%s', $scheme, $portalUrl), '/') . $resourceLocator;
    }
667968
protected function pathinfoInternal(?string $scheme, string $path, int $options = null)
    {
        $info = $options ? \pathinfo($path, $options) : \pathinfo($path);

        if (null !== $scheme) {
            $info['scheme'] = $scheme;
            $dirname = isset($info['dirname']) && $info['dirname'] !== '.' ? $info['dirname'] : null;

            if (null !== $dirname) {
                $info['dirname'] = $scheme . '://' . $dirname;
            } else {
                $info = ['dirname' => $scheme . '://'] + $info;
            }
        }

        return $info;
    }
1020265
public function get($propertyName, $funcName, array $arguments = [], array &$errorValues = [], array &$errors)
    {
        if (false === \array_key_exists($funcName, $this->functionMap)) {
            throw new \InvalidArgumentException(
                \sprintf('Validator key \'%s\' not found', $funcName)
            );
        }

        $function = $this->functionMap[$funcName];
        $class    = \explode("::", $function);

        try {
            $result = \call_user_func_array([$class[0], $class[1]], $arguments);

            if (false === $result) {
                $funcName = $this->funcNameToUnderscore($funcName);
                if (false === \array_key_exists($funcName, $errors)) {
                    throw new \InvalidArgumentException(
                        \sprintf('Validator key \'%s\' not found in error file', $funcName)
                    );
                }

                if (\strlen($errors[$funcName]) > 0) {
                    $this->validator->setError(
                        $this->buildErrorMessage($errorValues, $errors, $funcName, $propertyName),
                        $funcName
                    );
                }
            }
        } catch (FileUploadException $e) {
            $lowerCaseFuncName = $this->funcNameToUnderscore($e->getMessage());
            $this->validator->setError(
                $this->buildErrorMessage($errorValues, $errors, $e->getMessage(), $propertyName),
                $lowerCaseFuncName
            );

            $result = false;
        }

        return $result;
    }