mirror of
https://github.com/YGGverse/net-php.git
synced 2026-03-31 17:15:35 +00:00
replace getAbsolute with toAbsolute
This commit is contained in:
parent
0acff609f4
commit
0079e2a755
1 changed files with 22 additions and 7 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue