1 | <?php |
||
5 | class ExpoMessage |
||
6 | { |
||
7 | /** |
||
8 | * The message body. |
||
9 | * |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $body; |
||
13 | |||
14 | /** |
||
15 | * The sound to play when the recipient receives this notification. |
||
16 | * |
||
17 | * @var string|null |
||
18 | */ |
||
19 | protected $sound = 'default'; |
||
20 | |||
21 | /** |
||
22 | * The number to display next to the push notification (iOS). |
||
23 | * Specify zero to clear the badge. |
||
24 | * |
||
25 | * @var int |
||
26 | */ |
||
27 | protected $badge = 0; |
||
28 | |||
29 | /** |
||
30 | * The number of seconds for which the message may be kept around for redelivery if it has not been delivered yet. |
||
31 | * |
||
32 | * @var int |
||
33 | */ |
||
34 | protected $ttl = 0; |
||
35 | |||
36 | /** |
||
37 | * @param string $body |
||
38 | * |
||
39 | * @return static |
||
40 | */ |
||
41 | 1 | public static function create($body = '') |
|
45 | |||
46 | /** |
||
47 | * ExpoMessage constructor. |
||
48 | * |
||
49 | * @param string $body |
||
50 | */ |
||
51 | 9 | public function __construct(string $body = '') |
|
55 | |||
56 | /** |
||
57 | * Set the message body. |
||
58 | * |
||
59 | * @param string $value |
||
60 | * |
||
61 | * @return $this |
||
62 | */ |
||
63 | 1 | public function body(string $value) |
|
69 | |||
70 | /** |
||
71 | * Enable the message sound. |
||
72 | * |
||
73 | * @return $this |
||
74 | */ |
||
75 | 1 | public function enableSound() |
|
81 | |||
82 | /** |
||
83 | * Disable the message sound. |
||
84 | * |
||
85 | * @return $this |
||
86 | */ |
||
87 | 2 | public function disableSound() |
|
93 | |||
94 | /** |
||
95 | * Set the message badge (iOS). |
||
96 | * |
||
97 | * @param int $value |
||
98 | * |
||
99 | * @return $this |
||
100 | */ |
||
101 | 1 | public function badge(int $value) |
|
107 | |||
108 | /** |
||
109 | * Set the time to live of the notification |
||
110 | * |
||
111 | * @param int $ttl |
||
112 | * |
||
113 | * @return $this |
||
114 | */ |
||
115 | 1 | public function setTtl(int $ttl) |
|
121 | |||
122 | /** |
||
123 | * Get an array representation of the message |
||
124 | * |
||
125 | * @return array |
||
126 | */ |
||
127 | 9 | public function toArray() |
|
136 | } |
||
137 |