Skip to content

Commit

Permalink
Add isInvalidToken method
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Fuentes committed Oct 30, 2019
1 parent ba41e23 commit 20a0fd8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Khrizt/PushNotiphications/Model/Apns/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ public function isUnregisteredToken(): bool
return $this->status === 410;
}

/**
* Returns if notification was sent to an unregistered token.
*
* @return bool
*/
public function isInvalidToken(): bool
{
return $this->errorCode === "BadDeviceToken";
}

/**
* Gets the value of status.
*
Expand Down
10 changes: 10 additions & 0 deletions src/Khrizt/PushNotiphications/Model/Fcm/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ public function isUnregisteredToken(): bool
return $this->errorCode === 'NotRegistered';
}

/**
* Returns if notification was sent to an unregistered token.
*
* @return bool
*/
public function isInvalidToken(): bool
{
return $this->errorCode === "InvalidRegistration";
}

/**
* Gets the value of errorCode.
*
Expand Down
2 changes: 2 additions & 0 deletions src/Khrizt/PushNotiphications/Model/ResponseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public function getToken(): string;

public function isUnregisteredToken(): bool;

public function isInvalidToken(): bool;

public function isOk(): bool;

public function getErrorCode(): ?string;
Expand Down

0 comments on commit 20a0fd8

Please sign in to comment.