Skip to content

Commit

Permalink
Merge pull request #12 from redjanym/develop
Browse files Browse the repository at this point in the history
Fix adding a null value as a device token at service constructor
  • Loading branch information
redjanym authored Aug 13, 2017
2 parents e4c7bd3 + 504be54 commit da46a64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Entity/DeviceNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public function setDeviceToken($token)
*/
public function addDeviceToken($token)
{
if(is_string($token) === false){
throw new \InvalidArgumentException('Token must be a string!');
}

$this->deviceTokens->add($token);

return $this;
Expand All @@ -48,6 +52,10 @@ public function addDeviceToken($token)
*/
public function setDeviceTokens($tokens)
{
if(is_array($tokens) === false){
throw new \InvalidArgumentException('Tokens must be an array of strings!');
}

$this->deviceTokens = new ArrayCollection($tokens);

return $this;
Expand Down
2 changes: 1 addition & 1 deletion FCMClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(Client $client)
* @param null | array $token
* @return DeviceNotification
*/
public function createDeviceNotification($title = null, $body = null, $token = null)
public function createDeviceNotification($title = null, $body = null, $token = array())
{
$notification = new DeviceNotification();
$notification
Expand Down

0 comments on commit da46a64

Please sign in to comment.