You are here

public function Subscription::hasSubscription in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-feed/src/PubSubHubbub/Model/Subscription.php \Zend\Feed\PubSubHubbub\Model\Subscription::hasSubscription()

Determine if a subscription matching the key exists

Parameters

string $key:

Return value

bool

Throws

PubSubHubbub\Exception\InvalidArgumentException

Overrides SubscriptionPersistenceInterface::hasSubscription

File

vendor/zendframework/zend-feed/src/PubSubHubbub/Model/Subscription.php, line 87

Class

Subscription

Namespace

Zend\Feed\PubSubHubbub\Model

Code

public function hasSubscription($key) {
  if (empty($key) || !is_string($key)) {
    throw new PubSubHubbub\Exception\InvalidArgumentException('Invalid parameter "key"' . ' of "' . $key . '" must be a non-empty string');
  }
  $result = $this->db
    ->select([
    'id' => $key,
  ]);
  if (count($result)) {
    return true;
  }
  return false;
}