Browse Source

replace getAbsolute with toAbsolute

main
yggverse 7 days ago
parent
commit
0079e2a755
  1. 29
      src/Address.php

29
src/Address.php

@ -283,18 +283,18 @@ class Address @@ -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 @@ -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 @@ -351,7 +351,7 @@ class Address
{
if (empty($prefix[$index]))
{
return null;
return false;
}
unset(
@ -377,8 +377,23 @@ class Address @@ -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;
}
}
Loading…
Cancel
Save