diff --git a/src/Socialbox/Abstracts/Entity.php b/src/Socialbox/Abstracts/Entity.php new file mode 100644 index 0000000..129ac00 --- /dev/null +++ b/src/Socialbox/Abstracts/Entity.php @@ -0,0 +1,88 @@ +uuid = $data['uuid']; + $this->type = $data['type']; + $this->username = $data['username']; + $this->domain = $data['domain']; + $this->display_name = $data['display_name']; + } + + /** + * Returns the Unique Universal Identifier (UUID v4) of the entity. + * + * @return string + */ + public function getUuid(): string + { + return $this->uuid; + } + + /** + * Returns the EntityType of the entity. + * + * @return EntityType + */ + public function getType(): EntityType + { + return $this->type; + } + + /** + * Returns the username of the entity. + * + * @return string + */ + public function getUsername(): string + { + return $this->username; + } + + /** + * Returns the domain that the entity belongs to, `LOCAL` for local entities. + * + * @return string + */ + public function getDomain(): string + { + return $this->domain; + } + + /** + * Returns the display name of the entity. + * + * @return string + */ + public function getDisplayName(): string + { + return $this->display_name; + } + + /** + * Returns the address of the entity in the format `username@domain`. + * + * @return string + */ + public function getAddress(): string + { + return sprintf('%s@%s', $this->username, $this->domain); + } +} \ No newline at end of file diff --git a/src/Socialbox/Enums/EntityType.php b/src/Socialbox/Enums/EntityType.php new file mode 100644 index 0000000..bb995de --- /dev/null +++ b/src/Socialbox/Enums/EntityType.php @@ -0,0 +1,10 @@ +