diff --git a/src/Message.php b/src/Message.php index 996419e..0efa365 100644 --- a/src/Message.php +++ b/src/Message.php @@ -19,7 +19,7 @@ class Message implements \JsonSerializable private $notification; private $collapseKey; private $priority; - private $data; + private $data = []; private $recipients = []; private $recipientType; private $jsonData; @@ -71,7 +71,7 @@ public function setPriority($priority) public function setData(array $data) { - $this->data = $data; + $this->data = array_merge($this->data, $data); return $this; } diff --git a/src/Notification.php b/src/Notification.php index ad18565..28c171c 100644 --- a/src/Notification.php +++ b/src/Notification.php @@ -14,6 +14,7 @@ class Notification extends Message private $clickAction; private $tag; private $content_available; + private $image; public function __construct($title = '', $body = '') { @@ -84,6 +85,12 @@ public function setContentAvailable($content_available) return $this; } + public function setImage($image) + { + $this->image = $image; + return $this; + } + public function jsonSerialize() { $jsonData = $this->getJsonData(); @@ -111,6 +118,9 @@ public function jsonSerialize() if ($this->content_available) { $jsonData['content_available'] = $this->content_available; } + if ($this->image) { + $jsonData['image'] = $this->image; + } return $jsonData; } }