/** * Unsubscribes an endpoint from a SNS Topic * * The method will return TRUE on success, or FALSE if the Endpoint did not * have a Subscription on the SNS Topic * * @param string $topicArn The ARN of the Topic * @param string $protocol The protocol of the Endpoint * @param string $endpoint The Endpoint of the Subscriber * * @return Boolean */ public function unsubscribeFromTopic($topicArn, $protocol, $endpoint) { // Check against the current Topic Subscriptions $subscriptions = $this->getTopicSubscriptions($topicArn); foreach ($subscriptions as $subscription) { if ($endpoint === $subscription['Endpoint']) { $this->sns->unsubscribe(['SubscriptionArn' => $subscription['SubscriptionArn']]); $context = ['Endpoint' => $endpoint, 'Protocol' => $protocol, 'SubscriptionArn' => $subscription['SubscriptionArn']]; $this->log(200, "Endpoint unsubscribed from SNS Topic", $context); return true; } } return false; }