File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -395,10 +395,6 @@ public function setUrl(Url $url): void
395
395
{
396
396
$ this ->url = $ url ;
397
397
398
- if ($ this ->url ->getHost () === null && $ this ->getHost () !== null ) {
399
- $ this ->url ->setHost ((string )$ this ->getHost ());
400
- }
401
-
402
398
if ($ this ->isSecure () === true ) {
403
399
$ this ->url ->setScheme ('https ' );
404
400
}
Original file line number Diff line number Diff line change @@ -144,10 +144,15 @@ public function setScheme(string $scheme): self
144
144
/**
145
145
* Get url host
146
146
*
147
+ * @param bool $includeTrails Prepend // in front of hostname
147
148
* @return string|null
148
149
*/
149
- public function getHost (): ?string
150
+ public function getHost (bool $ includeTrails = false ): ?string
150
151
{
152
+ if ((string )$ this ->host !== '' && $ includeTrails === true ) {
153
+ return '// ' . $ this ->host ;
154
+ }
155
+
151
156
return $ this ->host ;
152
157
}
153
158
@@ -530,12 +535,12 @@ public function getAbsoluteUrl(bool $includeParams = true): string
530
535
*/
531
536
public function jsonSerialize (): string
532
537
{
533
- return $ this ->getRelativeUrl ();
538
+ return $ this ->getHost ( true ) . $ this -> getRelativeUrl ();
534
539
}
535
540
536
541
public function __toString (): string
537
542
{
538
- return $ this ->getRelativeUrl ();
543
+ return $ this ->getHost ( true ) . $ this -> getRelativeUrl ();
539
544
}
540
545
541
546
}
You can’t perform that action at this time.
0 commit comments