summaryrefslogtreecommitdiff
path: root/matrix-specification/Responses/ClientAccountWhoamiGetResponse.php
blob: 48fbbde89c11553ca7275efcbbd21a55c20c2eaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

namespace Matrix\Responses;

class ClientAccountWhoamiGetResponse implements \JsonSerializable
{
  public function __construct(
    private string $userId,
    private ?string $deviceId = null,
    private ?bool $isGuest = null,
  )
  {}

  public function jsonSerialize(): array
  {
    return array_filter([
      "device_id" => $this->deviceId,
      "is_guest" => $this->isGuest,
      "user_id" => $this->userId,
    ], "is_null");
  }
}