Fix uri factory init

This commit is contained in:
Dennis Eichhorn 2017-02-17 21:47:31 +01:00
parent f0ccfc023a
commit a2566d3e3c
2 changed files with 25 additions and 11 deletions

View File

@ -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) {

View File

@ -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 <d.eichhorn@oms.com>
*/
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
*