Create a new Loader from an URI.

@since 0.4.0

@param string $uri URI of the resource to create a loader for.

@return LoaderInterface Loader that is able to load the given URI.
@throws FailedToLoadConfigException If no suitable loader was found.
352346
public static function createFromUri($uri)
    {
        foreach (static::$loaders as $loader) {
            if ($loader::canLoad($uri)) {
                return static::getLoader($loader);
            }
        }

        throw new FailedToLoadConfigException(
            sprintf(
                _('Could not find a suitable loader for URI "%1$s".'),
                $uri
            )
        );
    }
696691
public function setUri($uri)
    {
        if (null === $uri) {
            $uri = 'amqp://guest:guest@localhost:5672/';
        }
        $this->uri = parse_url($uri);
        if (($this->uri['scheme'] != 'amqp' && $this->uri['scheme'] != 'amqps')) {
            throw new \UnexpectedValueException(
                sprintf(
                    'a valid URI scheme is request expected format [%s] ' .
                        'received: [%s]', 'tcp://user:pass@host:port/vhost',
                    $uri
                )
            );
        }
        if (empty($this->uri['user']) || empty($this->uri['pass'])) {
            throw new \RuntimeException(
                'AMQPLAIN Auth requires both a user and pass be specified'
            );
        }
        if ($this->uri['scheme'] === 'amqps') {
            if (!extension_loaded('openssl')) {
                throw new \RuntimeException(
                    'SSL connection attempted however openssl extension is not loaded'
                );
            }
            $ssl_context = stream_context_create();
            foreach ($this->options['ssl_options'] as $k => $v) {
                stream_context_set_option($ssl_context, 'ssl', $k, $v);
            }
        }
        return $this;
    }
580560
public function fillCache($uri)
    {
        $cacheKey = $uri . '@cache';

        if (!isset($this->cache[$cacheKey])) {
            $this->cache[$cacheKey] = true;

            $iterator = new \RecursiveIteratorIterator($this->getRecursiveIterator($uri), \RecursiveIteratorIterator::SELF_FIRST);

            /** @var UniformResourceIterator $uri */
            foreach ($iterator as $item) {
                $key = $item->getUrl() . '@010';
                $this->cache[$key] = $item->getPathname();
            }
        }

        return $this;
    }
1020838
public static UriBuilder fromUri(Uri uri) throws IllegalArgumentException {
        if (uri == null)
            throw new IllegalArgumentException("Uri cannot be null");

        UriBuilder b = newInstance();
        b.uri(uri);
        return b;
    }
418394
public function withUri(UriInterface $uri, $preserveHost = false)
    {
        $new = self::create($uri);
        if ($preserveHost) {
            $new->headers->set('HOST', $this->getHost());
        }

        return $new;
    }
314284
protected function fromString($uri)
    {
        if (empty($uri)) {
            return $this;
        }

        $this->fromArray(parse_url($uri));

        return $this;
    }
1262276
public function loadRoute($uri)
    {
        $route = $this->getRoute($uri);

        if($route)
        {
            $controllerPath = $this->getControllerPath($route);

            if($controllerPath)
            {
                require $controllerPath;

                $controller = $this->initController($route->getControllerName(), $route->getControllerPath());
                $this->runController($controller, $route->getAction(), $route->getValues());
            }
        }
        else
        {
            throw new \Exception("No route was found that matched the requested URI.", 1);
        }
    }
1045567
public function setUriProvider( $uri = null)
	{
		$toSetUri = $uri;
		if(!$uri) {
			$toSetUri = $this->getUriPrefix().'providers';
		}

		$this->_uriProvider = $toSetUri;
	}
1136458
public function load(UriInterface $uri)
    {
        if (!$uri instanceof DataUriInterface) {
            throw new InvalidUriTypeException(
                $uri,
                'Eloquent\Schemer\Uri\DataUriInterface'
            );
        }

        return new Content(
            $uri->getData(),
            $this->stripMimeTypeParameters($uri->getMimeType())
        );
    }
783668
public static UriBuilder fromUri(String uri) {
        if (uri == null)
            throw new IllegalArgumentException("Uri cannot be null");

        final UriBuilder builder = newInstance();
        builder.uri(Uri.create(uri));
        return builder;
    }
433191
public static function loader($loader = null)
    {
        if (is_object($loader)) {
            self::$loader = $loader;
        }

        return isset(self::$loader) ? self::$loader : self::$loader = new Loader;
    }
561518
public function getFileLoader(): LoaderInterface
    {
        if (!isset($this->fileLoader)) {
            $this->fileLoader = new DelegateLoader();
        }

        return $this->fileLoader;
    }
65395
protected function fromString($uri)
    {
        if (! is_string($uri)) {
            throw new InvalidArgumentException(sprintf(
                '"%s()" expects string; "%s" received.',
                __METHOD__,
                is_object($uri) ? get_class($uri) : gettype($uri)
            ));
        }

        $this
            ->setUserInfo(
                parse_url($uri, PHP_URL_USER),
                parse_url($uri, PHP_URL_PASS)
            )
            ->setScheme(parse_url($uri,   PHP_URL_SCHEME))
            ->setHost(parse_url($uri,     PHP_URL_HOST))
            ->setPath(parse_url($uri,     PHP_URL_PATH))
            ->setQuery(parse_url($uri,    PHP_URL_QUERY))
            ->setFragment(parse_url($uri, PHP_URL_FRAGMENT));

        if ($port = parse_url($uri, PHP_URL_PORT)) {
            $this->setPort($port);
        }

        return $this;
    }
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;
    }
109724
public function build($uri)
	{
		// Create the URI object
		$uri = $this->createUri($uri);

		// Process the uri information based on custom defined rules
		foreach ($this->rules['build'] as $rule)
		{
			$uri = $rule($uri);
		}

		return $uri;
	}
1210832
protected function determineLoaderFromPath(string $source): LoaderInterface
    {
        if (isset($this->loaders[$source])) {
            return $this->loaders[$source];
        }

        $key = is_dir($source) ? 'dir' : (pathinfo($source, PATHINFO_EXTENSION) ?: null);

        if (!isset($key) || !isset($this->loaders[$key])) {
            throw new NoLoaderException("Don't know how to load configuration from '$source'");
        }

        return $this->loaders[$key];
    }
1048625
private function parse($uri)
    {
        $this->parsedUri = parse_url($uri);

        if (false === strstr($this->parsedUri['path'], $this->config->getRootEndpoint())) {
            throw RestException::invalidEndpoint($this->parsedUri['path']);
        }

        $this->adjustRootEndpoint($this->parsedUri['path']);

        $this->parsedUri['path'] = str_replace($this->config->getRootEndpoint(), '', $this->parsedUri['path']);
        $this->parsePath($this->parsedUri['path']);

        $this->parsedUri['query'] = isset($this->parsedUri['query']) ? $this->parsedUri['query'] : '';
        $this->parseQueryString($this->parsedUri['query']);

        return $this;
    }