1
0
mirror of https://github.com/YGGverse/net-php.git synced 2025-01-11 15:37:56 +00:00

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;
}
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 $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;
}
}