diff options
Diffstat (limited to 'matrix-specification/Data/Room/TextualRepresentation.php')
| -rw-r--r-- | matrix-specification/Data/Room/TextualRepresentation.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/matrix-specification/Data/Room/TextualRepresentation.php b/matrix-specification/Data/Room/TextualRepresentation.php new file mode 100644 index 0000000..9b66f48 --- /dev/null +++ b/matrix-specification/Data/Room/TextualRepresentation.php @@ -0,0 +1,20 @@ +<?php + +namespace Matrix\Data\Room; + +class TextualRepresentation implements \JsonSerializable +{ + public function __construct( + private string $body, + private ?string $mimeType = "text/plain", + ) + {} + + public function jsonSerialize(): array + { + return array_filter([ + "body" => $this->body, + "mimetype" => $this->mimeType, + ], fn ($value) => ! is_null($value)); + } +} |
