Refactor getIncomingChannels to improve peer address validation logic

https://github.com/nosial/Socialbox-PHP/issues/25
This commit is contained in:
netkas 2025-03-07 21:50:23 -05:00
parent ea3a070d13
commit 6be9e90ceb

View file

@ -335,14 +335,15 @@
*/
public static function getIncomingChannels(string|PeerAddress $peerAddress, int $page=1, int $limit=100): array
{
if(is_string($peerAddress) && !Validator::validatePeerAddress($peerAddress))
{
throw new InvalidArgumentException('Invalid Peer Address');
}
if($peerAddress instanceof PeerAddress)
{
$peerAddress = $peerAddress->getAddress();
}
elseif(!Validator::validatePeerAddress($peerAddress))
{
throw new InvalidArgumentException('Invalid Peer Address');
}
if($page < 1)
{