You are here

protected function Subscription::ensureToken in Feeds 8.3

Ensures that this subscription has a valid token.

2 calls to Subscription::ensureToken()
Subscription::preSave in src/Entity/Subscription.php
Acts on an entity before the presave hook is invoked.
Subscription::validateState in src/Entity/Subscription.php
Validates the state of the subscription.

File

src/Entity/Subscription.php, line 159

Class

Subscription
Defines the subscription entity class.

Namespace

Drupal\feeds\Entity

Code

protected function ensureToken() {
  if (!$this
    ->getToken()) {
    $this
      ->set('token', substr(Crypt::randomBytesBase64(20), 0, 20));
  }
}