diff options
Diffstat (limited to 'matrix-specification/UserIdentifier.php')
| -rw-r--r-- | matrix-specification/UserIdentifier.php | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/matrix-specification/UserIdentifier.php b/matrix-specification/UserIdentifier.php deleted file mode 100644 index 63f939a..0000000 --- a/matrix-specification/UserIdentifier.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -namespace Matrix; - -use Matrix\Enums\UserIdentifierType; - -class UserIdentifier implements \JsonSerializable -{ - public function __construct( - private UserIdentifierType $type, - private ?string $user = null, - private ?string $thirdPartyMedium = null, - private ?string $thirdPartyAddress = null, - private ?string $phoneCountry = null, - private ?string $phoneNumber = null, - ) - {} - - public function jsonSerialize(): array - { - $userIdentifier = [ - "type" => $this->type, - ]; - - $userIdentifier += match ($this->type) { - UserIdentifierType::USER => [ - "user" => $this->user, - ], - - UserIdentifierType::THIRDPARTY => [ - "medium" => $this->thirdPartyMedium, - "address" => $this->thirdPartyAddress, - ], - - UserIdentifierType::PHONE => [ - "country" => $this->phoneCountry, - "phone" => $this->phoneNumber, - ], - - default => [], - }; - - return $userIdentifier; - } -} |
