Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Message implements \JsonSerializable
private $notification;
private $collapseKey;
private $priority;
private $data;
private $data = [];
private $recipients = [];
private $recipientType;
private $jsonData;
Expand Down Expand Up @@ -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;
}

Expand Down
10 changes: 10 additions & 0 deletions src/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Notification extends Message
private $clickAction;
private $tag;
private $content_available;
private $image;

public function __construct($title = '', $body = '')
{
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}
}