mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Add better uri creation from current
This commit is contained in:
parent
632ce1c4dc
commit
89c14a69b8
|
|
@ -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());
|
||||
|
|
|
|||
14
Uri/Http.php
14
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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user