summaryrefslogtreecommitdiff
path: root/matrix-specification/Responses/ClientRefreshPostResponse.php
blob: b1e1154a86d7b7cc5aea44835af1c9bd4c0d813c (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 ClientRefreshPostResponse implements \JsonSerializable
{
  public function __construct(
    private string $accessToken,
    private ?int $expiresInMilliseconds = null,
    private ?string $refreshToken = null,
  )
  {}

  public function jsonSerialize(): array
  {
    return array_filter([
      "access_token" => $this->accessToken,
      "expires_in_ms" => $this->expiresInMilliseconds,
      "refresh_token" => $this->refreshToken,
    ], "is_null");
  }
}