You are here

public function RecipientHandlerBase::count in Simplenews 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/simplenews/RecipientHandler/RecipientHandlerBase.php \Drupal\simplenews\Plugin\simplenews\RecipientHandler\RecipientHandlerBase::count()
  2. 3.x src/Plugin/simplenews/RecipientHandler/RecipientHandlerBase.php \Drupal\simplenews\Plugin\simplenews\RecipientHandler\RecipientHandlerBase::count()

File

src/Plugin/simplenews/RecipientHandler/RecipientHandlerBase.php, line 55

Class

RecipientHandlerBase
Base class for all Recipient Handler classes.

Namespace

Drupal\simplenews\Plugin\simplenews\RecipientHandler

Code

public function count() {
  $cache =& drupal_static(__METHOD__, []);
  $cid = $this->pluginId . ':' . implode(':', $this->newsletterIds);
  if (isset($cache[$cid])) {
    return $cache[$cid];
  }
  $count = $this
    ->doCount();
  if ($this
    ->cacheCount()) {
    $cache[$cid] = $count;
  }
  return $count;
}