diff --git a/Message/Http/Request.php b/Message/Http/Request.php index 99d4fd75c..e6bca7e94 100644 --- a/Message/Http/Request.php +++ b/Message/Http/Request.php @@ -108,7 +108,7 @@ final class Request extends RequestAbstract */ private function initCurrentRequest() : void { - $this->uri = new Http(Http::getCurrent()); + $this->uri = Http::fromCurrent(); $this->data = $_GET ?? []; $this->files = $_FILES ?? []; $this->header->getL11n()->setLanguage($this->loadRequestLanguage()); diff --git a/Uri/Http.php b/Uri/Http.php index 61619e171..eaaab587c 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -193,6 +193,18 @@ final class Http implements UriInterface . '://' . ($_SERVER['HTTP_HOST'] ?? ''). ($_SERVER['REQUEST_URI'] ?? ''); } + /** + * Create uri from current url + * + * @return Http Returns the current uri + * + * @since 1.0.0 + */ + public static function fromCurrent() : self + { + return new self(self::getCurrent()); + } + /** * {@inheritdoc} */ @@ -250,7 +262,7 @@ final class Http implements UriInterface return ''; } - return \array_slice($host, 0, $length); + return \implode('.', \array_slice($host, 0, $length)); } /**