From 1cab09b6752cfcf07bbc1b2943863977b8287841 Mon Sep 17 00:00:00 2001 From: netkas Date: Tue, 14 Jan 2025 15:45:02 -0500 Subject: [PATCH] Add isExternal method to PeerAddress class --- src/Socialbox/Objects/PeerAddress.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Socialbox/Objects/PeerAddress.php b/src/Socialbox/Objects/PeerAddress.php index b603399..a2640fe 100644 --- a/src/Socialbox/Objects/PeerAddress.php +++ b/src/Socialbox/Objects/PeerAddress.php @@ -71,6 +71,21 @@ return $this->username === ReservedUsernames::HOST->value && $this->domain === Configuration::getInstanceConfiguration()->getDomain(); } + /** + * Determines if the peer is external. + * + * @return bool True if the peer is external, false otherwise. + */ + public function isExternal(): bool + { + if($this->isHost()) + { + return false; + } + + return $this->username === ReservedUsernames::HOST->value; + } + /** * Returns whether the peer requires authentication, for example, the anonymous user does not require authentication *