From 41acc22c55846e9a1c455b750345c658b5f7d1cc Mon Sep 17 00:00:00 2001 From: Jeroen Desloovere Date: Thu, 1 Dec 2016 08:57:14 +0100 Subject: [PATCH] Changed "get" method to "exists" method like it is required --- Gateway/MailChimpSubscriberGateway.php | 28 ++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Gateway/MailChimpSubscriberGateway.php b/Gateway/MailChimpSubscriberGateway.php index 6d0a951..17e9347 100644 --- a/Gateway/MailChimpSubscriberGateway.php +++ b/Gateway/MailChimpSubscriberGateway.php @@ -30,14 +30,38 @@ public function __construct( $this->api = $api; } + /** + * Exists + * + * @param string $email + * @param string $listId + * @return boolean + */ + public function exists ( + $email, + $listId + ) { + try { + // Define result + $result = $this->get( + $email, + $listId + ); + + return (!empty($result)); + } catch (\Exception $e) { + return false; + } + } + /** * Get a subscriber * * @param string $email * @param string $listId - * @return array + * @return mixed boolean|Illuminate\Support\Collection */ - public function get( + private function get( $email, $listId ) {