Skip to content

Commit

Permalink
Merge pull request #1 from jonasdekeukelaere/fix-subscribing
Browse files Browse the repository at this point in the history
Fix checking the state of subscriber that does not exists
  • Loading branch information
jeroendesloovere authored Jun 15, 2017
2 parents 831b9e1 + a0307f7 commit e9df4e0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Gateway/CampaignMonitorSubscriberGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public function hasStatus(
/** @var \CS_REST_Wrapper_Result $result A successful response will be empty */
$result = $this->api->get($email);

if (!property_exists($result->response, 'State')) {
return false;
}

switch ($status) {
case Subscriber::MEMBER_STATUS_UNSUBSCRIBED:
return (in_array($result->response->State, array('Unconfirmed', 'Unsubscribed', 'Bounced', 'Deleted')));
Expand Down

0 comments on commit e9df4e0

Please sign in to comment.