- Fixed domains not being prepending properly to urls.

- Won't prepend subdomain to urls if subdomain is equal to current host.
- Url: implemented parse function.
- Router: getUrl now parses url to properly parse the subdomain.
This commit is contained in:
Simon
2023-11-27 05:52:10 +01:00
parent a275366a90
commit ed1ed43484
9 changed files with 55 additions and 46 deletions
+9 -1
View File
@@ -67,7 +67,11 @@ class Url implements JsonSerializable
public function __construct(?string $url)
{
$this->originalUrl = $url;
$this->parse($url, true);
}
public function parse(?string $url, bool $setOriginalPath = false): self
{
if ($url !== null && $url !== '/') {
$data = $this->parseUrl($url);
@@ -79,7 +83,10 @@ class Url implements JsonSerializable
if (isset($data['path']) === true) {
$this->setPath($data['path']);
$this->originalPath = $data['path'];
if ($setOriginalPath === true) {
$this->originalPath = $data['path'];
}
}
$this->fragment = $data['fragment'] ?? null;
@@ -88,6 +95,7 @@ class Url implements JsonSerializable
$this->setQueryString($data['query']);
}
}
return $this;
}
/**