Add Peer class and conversion method in RegisteredPeerRecord

This commit is contained in:
netkas 2025-01-03 18:30:40 -05:00
parent a3976742d6
commit d732c89632
2 changed files with 119 additions and 0 deletions

View file

@ -6,6 +6,7 @@
use Socialbox\Classes\Configuration;
use Socialbox\Enums\Flags\PeerFlags;
use Socialbox\Interfaces\SerializableInterface;
use Socialbox\Objects\Standard\Peer;
use Socialbox\Objects\Standard\SelfUser;
class RegisteredPeerRecord implements SerializableInterface
@ -191,6 +192,16 @@
return new SelfUser($this);
}
/**
* Converts the current instance to a Peer object.
*
* @return Peer The Peer representation of the current instance.
*/
public function toPeer(): Peer
{
return Peer::fromArray($this->toArray());
}
/**
* @inheritDoc
*/