diff --git a/Message/Http/Request.php b/Message/Http/Request.php index 46f78820f..8f474a1f5 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -133,7 +133,7 @@ class Request extends RequestAbstract */ private function initCurrentRequest() /* : void */ { - $this->uir = new Http(Http::getCurrent()); + $this->uri = new Http(Http::getCurrent()); $this->data = $_GET ?? []; $this->files = $_FILES ?? []; $this->language = $this->loadRequestLanguage(); @@ -205,17 +205,7 @@ class Request extends RequestAbstract */ private function setupUriBuilder() /* : void */ { - UriFactory::setQuery('/scheme', $this->uri->getScheme()); - UriFactory::setQuery('/host', $this->uri->getHost()); UriFactory::setQuery('/lang', $this->l11n->getLanguage()); - UriFactory::setQuery('/base', rtrim($this->uri->getBase(), '/')); - UriFactory::setQuery('/rootPath', $this->uri->getRootPath()); - UriFactory::setQuery('?', $this->uri->getQuery()); - UriFactory::setQuery('%', $this->uri->__toString()); - UriFactory::setQuery('#', $this->uri->getFragment()); - UriFactory::setQuery('/', $this->uri->getPath()); - UriFactory::setQuery(':user', $this->uri->getUser()); - UriFactory::setQuery(':pass', $this->uri->getPass()); // todo: flush previous foreach($this->data as $key => $value) { diff --git a/Uri/UriFactory.php b/Uri/UriFactory.php index 7c0ce571c..49e46a677 100644 --- a/Uri/UriFactory.php +++ b/Uri/UriFactory.php @@ -104,6 +104,30 @@ class UriFactory return true; } + /** + * Setup uri builder based on current request + * + * @param UriInterface $uri Uri + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public static function setupUriBuilder(UriInterface $uri) /* : void */ + { + self::setQuery('/scheme', $uri->getScheme()); + self::setQuery('/host', $uri->getHost()); + self::setQuery('/base', rtrim($uri->getBase(), '/')); + self::setQuery('/rootPath', $uri->getRootPath()); + self::setQuery('?', $uri->getQuery()); + self::setQuery('%', $uri->__toString()); + self::setQuery('#', $uri->getFragment()); + self::setQuery('/', $uri->getPath()); + self::setQuery(':user', $uri->getUser()); + self::setQuery(':pass', $uri->getPass()); + } + /** * Clear uri component *