1 | <?php |
||
19 | class Payload |
||
20 | { |
||
21 | /** |
||
22 | * @var Aps |
||
23 | */ |
||
24 | private $aps; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | private $customData; |
||
30 | |||
31 | /** |
||
32 | * Constructor. |
||
33 | * |
||
34 | * @param Aps $apsData |
||
35 | * @param array $customData |
||
36 | */ |
||
37 | public function __construct(Aps $apsData, array $customData = []) |
||
42 | |||
43 | /** |
||
44 | * Create new payload with body only. |
||
45 | * |
||
46 | * @param string $body |
||
47 | * |
||
48 | * @return Payload |
||
49 | */ |
||
50 | public static function createWithBody(string $body): Payload |
||
54 | |||
55 | /** |
||
56 | * Set aps |
||
57 | * |
||
58 | * @param Aps $aps |
||
59 | * |
||
60 | * @return Payload |
||
61 | */ |
||
62 | public function withAps(Aps $aps): Payload |
||
70 | |||
71 | /** |
||
72 | * Get APS data |
||
73 | * |
||
74 | * @return Aps |
||
75 | */ |
||
76 | public function getAps(): Aps |
||
80 | |||
81 | /** |
||
82 | * Add or replace custom data |
||
83 | * |
||
84 | * @param string $name |
||
85 | * @param mixed $value |
||
86 | * |
||
87 | * @return Payload |
||
88 | * |
||
89 | * @throws \InvalidArgumentException |
||
90 | */ |
||
91 | public function withCustomData(string $name, $value): Payload |
||
106 | |||
107 | /** |
||
108 | * Get custom data |
||
109 | * |
||
110 | * @return array |
||
111 | */ |
||
112 | public function getCustomData(): array |
||
116 | } |
||
117 |