Browse Source

replace getAbsolute with toAbsolute

main
yggverse 6 months ago
parent
commit
0079e2a755
  1. 29
      src/Address.php

29
src/Address.php

@ -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 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