Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 |
<?php
|
|
2 |
|
|
3 |
declare(strict_types=1); |
|
4 |
|
|
5 |
namespace Kreait\Firebase\Messaging; |
|
6 |
|
|
7 |
use DateTimeImmutable; |
|
8 |
use JsonSerializable; |
|
9 |
|
|
10 |
final class TopicSubscription implements JsonSerializable |
|
11 |
{
|
|
12 |
/** @var Topic */
|
|
13 |
private $topic; |
|
14 |
|
|
15 |
/** @var RegistrationToken */
|
|
16 |
private $registrationToken; |
|
17 |
|
|
18 |
/** @var DateTimeImmutable */
|
|
19 |
private $subscribedAt; |
|
20 |
|
|
21 | 12 |
public function __construct(Topic $topic, RegistrationToken $registrationToken, DateTimeImmutable $subscribedAt) |
22 |
{
|
|
23 | 12 |
$this->topic = $topic; |
24 | 12 |
$this->registrationToken = $registrationToken; |
25 | 12 |
$this->subscribedAt = $subscribedAt; |
26 |
}
|
|
27 |
|
|
28 | 3 |
public function topic(): Topic |
29 |
{
|
|
30 | 3 |
return $this->topic; |
31 |
}
|
|
32 |
|
|
33 |
public function registrationToken(): RegistrationToken |
|
34 |
{
|
|
35 |
return $this->registrationToken; |
|
36 |
}
|
|
37 |
|
|
38 | 3 |
public function subscribedAt(): DateTimeImmutable |
39 |
{
|
|
40 | 3 |
return $this->subscribedAt; |
41 |
}
|
|
42 |
|
|
43 |
/**
|
|
44 |
* @return array<string, string>
|
|
45 |
*/
|
|
46 |
public function jsonSerialize(): array |
|
47 |
{
|
|
48 |
return [ |
|
49 |
'topic' => $this->topic->value(), |
|
50 |
'registration_token' => $this->registrationToken->value(), |
|
51 |
'subscribed_at' => $this->subscribedAt->format(\DATE_ATOM), |
|
52 |
];
|
|
53 |
}
|
|
54 |
}
|
Read our documentation on viewing source code .