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
395395 {
396396 $ this ->url = $ url ;
397397
398- if ($ this ->url ->getHost () === null && $ this ->getHost () !== null ) {
399- $ this ->url ->setHost ((string )$ this ->getHost ());
400- }
401-
402398 if ($ this ->isSecure () === true ) {
403399 $ this ->url ->setScheme ('https ' );
404400 }
Original file line number Diff line number Diff line change @@ -144,10 +144,15 @@ public function setScheme(string $scheme): self
144144 /**
145145 * Get url host
146146 *
147+ * @param bool $includeTrails Prepend // in front of hostname
147148 * @return string|null
148149 */
149- public function getHost (): ?string
150+ public function getHost (bool $ includeTrails = false ): ?string
150151 {
152+ if ((string )$ this ->host !== '' && $ includeTrails === true ) {
153+ return '// ' . $ this ->host ;
154+ }
155+
151156 return $ this ->host ;
152157 }
153158
@@ -530,12 +535,12 @@ public function getAbsoluteUrl(bool $includeParams = true): string
530535 */
531536 public function jsonSerialize (): string
532537 {
533- return $ this ->getRelativeUrl ();
538+ return $ this ->getHost ( true ) . $ this -> getRelativeUrl ();
534539 }
535540
536541 public function __toString (): string
537542 {
538- return $ this ->getRelativeUrl ();
543+ return $ this ->getHost ( true ) . $ this -> getRelativeUrl ();
539544 }
540545
541546}
You can’t perform that action at this time.
0 commit comments