summaryrefslogtreecommitdiff
path: root/matrix-specification/Responses/ClientVersionsGetResponse.php
blob: 44d2cd0936d7a0d492e6d60352da3e9c0afffbb8 (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
25
26
<?php

namespace Matrix\Responses;

use Matrix\Response;

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

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