Skip to content

Commit

Permalink
Convenience method CheddarGetter_Response::getCustomerIsActive()
Browse files Browse the repository at this point in the history
  • Loading branch information
marcguyer committed Feb 15, 2011
1 parent a2dfc47 commit 3d83746
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Response.php
Expand Up @@ -242,6 +242,22 @@ public function getCustomerSubscription($code = null) {
return current($subscriptions);
}

/**
* Get an array representation of a single customer's current subscription
*
* @throws CheddarGetter_Response_Exception if the response type is incompatible or if a $code is not provided and the response contains more than one customer
* @return array
*/
public function getCustomerIsActive($code = null) {
$subscription = $this->getCustomerSubscription($code);
if ($subscription['canceledDatetime']) {
if (strtotime($subscription['canceledDatetime']) <= time()) {
return false;
}
}
return true;
}

/**
* Get an array representation of a single customer's subscriptions (history)
*
Expand Down

0 comments on commit 3d83746

Please sign in to comment.