@param string      $uri
@param string|null $defaultScheme

@return UriInterface
178344
public function create($uri, $defaultScheme = null)
    {
        if (!is_string($uri)) {
            throw new InvalidArgumentException('URI must be a string.');
        }

        $scheme = Uri::parseScheme($uri);
        if (null === $scheme) {
            $scheme = $defaultScheme;
        }
        $schemeClass = $this->schemeClass($scheme);

        return new $schemeClass($uri);
    }
684394
public function createAbsoluteUrl($uri)
    {
        if (!isset($uri)) {
            return null;
        }

        $uri = strval($uri);
        if ($this->isRelativeUri($uri)) {
            $parts = parse_url($uri);
            $path  = isset($parts['path']) ? $parts['path'] : '';
            $query = isset($parts['query']) ? $parts['query'] : '';
            $hash  = isset($parts['fragment']) ? $parts['fragment'] : '';

            return $this->baseUrl()->withPath($path)->withQuery($query)->withFragment($hash);
        }

        return $uri;
    }
745277
private function uriToFile($uri)
    {
        $uri = str_replace($this->baseUri, '', $uri);
        $schemaDir = realpath("{$this->kernelDir}/../vendor/claroline/json-quiz/format");

        return $schemaDir.'/'.$uri;
    }
942328
function urlFor($internalUri, $locale = NULL){
        $internalUri= ltrim($internalUri, '/');
        if($locale == NULL)return $this->request->realBaseUrl . $internalUri;
        else return $this->request->realBaseUrl . $locale . '/' . $internalUri;
    }
449015
public function getLayoutId(): \Psr\Http\Message\UriInterface
    {
        if (!$this->layoutId) {
            return new Uri();
        }

        return $this->layoutId;
    }
1103224
private function getUri(): UriInterface
    {
        $uri = $this->getNewUri();

        if (!empty($this->apiUrl['scheme'])) {
            $uri = $uri->withScheme($this->apiUrl['scheme']);
        }

        if (!empty($this->apiUrl['host'])) {
            $uri = $uri->withHost($this->apiUrl['host']);
        }

        if (!empty($this->apiUrl['port'])) {
            $uri = $uri->withPort($this->apiUrl['port']);
        }

        if (!empty($this->apiUrl['path'])) {
            $uri = $uri->withPath($this->apiUrl['path']);
        }

        if (!empty($this->apiUrl['query'])) {
            $uri = $uri->withQuery($this->apiUrl['query']);
        }

        if (!empty($this->apiUrl['fragment'])) {
            $uri = $uri->withFragment($this->apiUrl['fragment']);
        }

        return $uri;
    }
1147543
public function withNodeUri($uri)
    {
        $builder = new RiakNodeBuilder();
        $node    = $builder
            ->withProtocol(parse_url($uri, PHP_URL_SCHEME))
            ->withHost(parse_url($uri, PHP_URL_HOST))
            ->withPort(parse_url($uri, PHP_URL_PORT))
            ->withUser(parse_url($uri, PHP_URL_USER))
            ->withPass(parse_url($uri, PHP_URL_PASS))
            ->build();

        return $this->withNode($node);
    }
372322
public static function decomposeUri(UriInterface $uri)
    {
        $stackPattern = '(?<stack>.*([^-]|--)|-*)';
        $hashPattern = '(?<hash>[0-9a-f]{6,40})';
        $filenamePattern = '(?<filename>[A-Za-z\-\0-\9]+)';
        $formatPattern = '(?<format>.{3,4})';
        $pathPattern = '(?<hash>-.+-)';
        $path = $uri->getPath();
        // hash with seo-filename
        if (preg_match('#^/'.$stackPattern.'/'.$hashPattern.'/'.$filenamePattern.'\.'.$formatPattern.'$#', $path, $matches) ||
            // hash without seo-filename
            preg_match('#^/'.$stackPattern.'/'.$hashPattern.'.'.$formatPattern.'$#', $path, $matches) ||
            // remote_path with seo-filename
            preg_match('#^/'.$stackPattern.'/'.$pathPattern.'/'.$filenamePattern.'\.'.$formatPattern.'$#', $path, $matches) ||
            // remote_path without seo-filename
            preg_match('#^/'.$stackPattern.'/'.$pathPattern.'.'.$formatPattern.'$#', $path, $matches)) {
            return UriComponents::createFromArray($matches);
        }
    }
1267147
public static function url($uri,$param=[])
    {
        if(!is_object(self::$ds)){
            self::$ds=new Register();
        }
        return self::$ds->url($uri,$param);
    }
557464
public static function isAbsolutePathReference(UriInterface $uri)
    {
        return $uri->getScheme() === ''
            && $uri->getAuthority() === ''
            && isset($uri->getPath()[0])
            && $uri->getPath()[0] === '/';
    }
682560
public function createRelative($uri = null)
    {
        if (empty($uri)) {
            // Empty uri means baseurl
            return $this->baseUrl;
        } 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 siteUrl
            return rtrim($this->siteUrl . rtrim($uri, '/'), '/');
        }

        $uri = rtrim($uri, '/');
        return $this->baseUrl . '/' . $uri;
    }
471382
public function execute(string $uri = null) : ApplicationInterface
    {
        /** @var RouteInterface $route */
        $route = App::resolve('Router')->getRoute($uri);

        /** @var Middleware $middleware */
        $middleware = App::resolve('Middleware', [$route->getMiddlewares()]);

        $this->results = $middleware->dispatch(function () use ($route, $uri) {
            return App::resolve('FrontController')->dispatch($route)->getResult();
        });

        return $this;
    }
140041
public function match(UriInterface $uri, array $defaults): ?array
    {
        if (!$this->isCompiled()) {
            $this->compile();
        }

        $matches = [];
        if (!preg_match($this->compiled, $this->fetchTarget($uri), $matches)) {
            return null;
        }

        $matches = array_intersect_key($matches, $this->options);

        return array_merge($this->options, $defaults, $matches);
    }
239532
public function applyToUri(UriInterface $uri)
    {
        $query = array_replace(self::parse($uri->getQuery()), $this->data);

        return $uri->withQuery(self::build($query));
    }
761281
private function buildHost(UriInterface $uri): string
    {
        return $uri->getHost().($uri->getPort() !== null ? ':'.$uri->getPort() : '');
    }
1078162
public function confirmMediaType($uriRetriever, $uri)
    {
        $contentType = $uriRetriever->getContentType();

        if (is_null($contentType)) {
            // Well, we didn't get an invalid one
            return;
        }

        if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
            return;
        }

        foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
            if (strpos($uri, $endpoint) === 0) {
                return true;
            }
        }

        throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
    }
1316493
protected function getCookie($param = null, $defaultValue = null)
    {
        if ($param === null) {
            return $this->getRequest()->getCookie();
        }

        return $this->getRequest()->getCookie($param, $defaultValue);
    }