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

namespace Matrix\Responses;

class ClientVersionsGetResponse implements \JsonSerializable
{
  /**
   * @param string[] $versions
   * @param array<string, bool> $unstableFeatures
   */
  public function __construct(
    private array $versions,
    private ?array $unstableFeatures = null,
  )
  {}

  public function jsonSerialize(): array
  {
    return array_filter([
      "unstable_features" => $this->unstableFeatures,
      "versions" => $this->versions,
    ], "is_null");
  }
}