1 | <?php |
||
6 | class DataBuilder |
||
7 | { |
||
8 | |||
9 | /** |
||
10 | * An array of data. |
||
11 | * |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $data = []; |
||
15 | |||
16 | /** |
||
17 | * Setter for data. |
||
18 | * |
||
19 | * @param string $key The data key. |
||
20 | * @param string|bool|int $value The data value. |
||
21 | * @return \ker0x\Push\Adapter\Fcm\Message\DataBuilder |
||
22 | */ |
||
23 | public function addData($key, $value) |
||
32 | |||
33 | /** |
||
34 | * Getter for data. |
||
35 | * |
||
36 | * @param string $key The key we want to get. |
||
37 | * @return mixed |
||
38 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidDataException |
||
39 | */ |
||
40 | public function getData($key) |
||
48 | |||
49 | /** |
||
50 | * Return all data. |
||
51 | * |
||
52 | * @return array|null |
||
53 | */ |
||
54 | public function getAllData() |
||
58 | |||
59 | /** |
||
60 | * Remove the data with the key $key. |
||
61 | * |
||
62 | * @param string $key The key we want to remove. |
||
63 | * @return \ker0x\Push\Adapter\Fcm\Message\DataBuilder |
||
64 | */ |
||
65 | public function removeData($key) |
||
71 | |||
72 | /** |
||
73 | * Remove all data |
||
74 | * |
||
75 | * @return void |
||
76 | */ |
||
77 | public function removeAllData() |
||
81 | } |
||
82 |