| 1 | <?php |
||
| 7 | class WebPushMessage |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The notification id. |
||
| 11 | * |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected $id = null; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * The notification title. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $title; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The notification body. |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $body; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * The notification icon. |
||
| 32 | * |
||
| 33 | * @var string |
||
| 34 | */ |
||
| 35 | protected $icon = null; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * The notification actions. |
||
| 39 | * |
||
| 40 | * @var array |
||
| 41 | */ |
||
| 42 | protected $actions = []; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $body |
||
| 46 | * @return static |
||
| 47 | */ |
||
| 48 | public static function create($body = '') |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param string $body |
||
| 55 | */ |
||
| 56 | public function __construct($body = '') |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Set the notification id. |
||
| 64 | * |
||
| 65 | * @param string $value |
||
| 66 | * @return $this |
||
| 67 | */ |
||
| 68 | public function id($value) |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Set the notification title. |
||
| 77 | * |
||
| 78 | * @param string $value |
||
| 79 | * @return $this |
||
| 80 | */ |
||
| 81 | public function title($value) |
||
| 87 | |||
| 88 | /** |
||
| 89 | * Set the notification body. |
||
| 90 | * |
||
| 91 | * @param string $value |
||
| 92 | * @return $this |
||
| 93 | */ |
||
| 94 | public function body($value) |
||
| 100 | |||
| 101 | /** |
||
| 102 | * Set the notification icon. |
||
| 103 | * |
||
| 104 | * @param string $value |
||
| 105 | * @return $this |
||
| 106 | */ |
||
| 107 | public function icon($value) |
||
| 113 | |||
| 114 | /** |
||
| 115 | * Set an action. |
||
| 116 | * |
||
| 117 | * @param string $title |
||
| 118 | * @param string $action |
||
| 119 | * @return $this |
||
| 120 | */ |
||
| 121 | public function action($title, $action) |
||
| 127 | |||
| 128 | /** |
||
| 129 | * Get an array representation of the message. |
||
| 130 | * |
||
| 131 | * @return array |
||
| 132 | */ |
||
| 133 | public function toArray() |
||
| 143 | } |
||
| 144 |