replace getAbsolute with toAbsolute

This commit is contained in:
yggverse 2024-06-23 00:17:31 +03:00
parent 0acff609f4
commit 0079e2a755

View File

@ -283,18 +283,18 @@ class Address
return $address; return $address;
} }
public function getAbsolute( public function toAbsolute(
\Yggverse\Net\Address $base \Yggverse\Net\Address $base
): ?string ): bool
{ {
if ($this->isAbsolute()) if ($this->isAbsolute())
{ {
return $this->get(); return true;
} }
if ($base->isRelative()) if ($base->isRelative())
{ {
return null; return false;
} }
$this->setScheme( $this->setScheme(
@ -323,7 +323,7 @@ class Address
if (str_starts_with((string) $this->getPath(), $this->getSeparator())) if (str_starts_with((string) $this->getPath(), $this->getSeparator()))
{ {
return $this->get(); return true;
} }
if ($path = $this->getPath()) if ($path = $this->getPath())
@ -351,7 +351,7 @@ class Address
{ {
if (empty($prefix[$index])) if (empty($prefix[$index]))
{ {
return null; return false;
} }
unset( unset(
@ -377,8 +377,23 @@ class Address
) )
) )
); );
return true;
} }
return $this->get(); return false;
}
// @TODO deprecated, legacy needs only
public function getAbsolute(
\Yggverse\Net\Address $base
): ?string
{
if ($this->toAbsolute($base))
{
return $this->get();
}
return null;
} }
} }