mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 16:12:14 +00:00
Merge pull request #692 from skipperbent/v5-development
Version 5.4.1.1
This commit is contained in:
@@ -395,10 +395,6 @@ class Request
|
|||||||
{
|
{
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
|
|
||||||
if ($this->url->getHost() === null && $this->getHost() !== null) {
|
|
||||||
$this->url->setHost((string)$this->getHost());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->isSecure() === true) {
|
if ($this->isSecure() === true) {
|
||||||
$this->url->setScheme('https');
|
$this->url->setScheme('https');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,10 +144,15 @@ class Url implements JsonSerializable
|
|||||||
/**
|
/**
|
||||||
* Get url host
|
* Get url host
|
||||||
*
|
*
|
||||||
|
* @param bool $includeTrails Prepend // in front of hostname
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getHost(): ?string
|
public function getHost(bool $includeTrails = false): ?string
|
||||||
{
|
{
|
||||||
|
if ((string)$this->host !== '' && $includeTrails === true) {
|
||||||
|
return '//' . $this->host;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->host;
|
return $this->host;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,12 +535,12 @@ class Url implements JsonSerializable
|
|||||||
*/
|
*/
|
||||||
public function jsonSerialize(): string
|
public function jsonSerialize(): string
|
||||||
{
|
{
|
||||||
return $this->getRelativeUrl();
|
return $this->getHost(true) . $this->getRelativeUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
return $this->getRelativeUrl();
|
return $this->getHost(true) . $this->getRelativeUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user