From 0079e2a755789cc6e9c85b235644be2cc417b15c Mon Sep 17 00:00:00 2001 From: yggverse Date: Sun, 23 Jun 2024 00:17:31 +0300 Subject: [PATCH] replace getAbsolute with toAbsolute --- src/Address.php | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/Address.php b/src/Address.php index 7ed5232..d82756a 100644 --- a/src/Address.php +++ b/src/Address.php @@ -283,18 +283,18 @@ class Address return $address; } - public function getAbsolute( + public function toAbsolute( \Yggverse\Net\Address $base - ): ?string + ): bool { if ($this->isAbsolute()) { - return $this->get(); + return true; } if ($base->isRelative()) { - return null; + return false; } $this->setScheme( @@ -323,7 +323,7 @@ class Address if (str_starts_with((string) $this->getPath(), $this->getSeparator())) { - return $this->get(); + return true; } if ($path = $this->getPath()) @@ -351,7 +351,7 @@ class Address { if (empty($prefix[$index])) { - return null; + return false; } unset( @@ -377,8 +377,23 @@ class Address ) ) ); + + return true; + } + + return false; + } + + // @TODO deprecated, legacy needs only + public function getAbsolute( + \Yggverse\Net\Address $base + ): ?string + { + if ($this->toAbsolute($base)) + { + return $this->get(); } - return $this->get(); + return null; } } \ No newline at end of file