You are here

interface PhoneNumberVerificationInterface in SMS Framework 8

Same name in this branch
  1. 8 src/Provider/PhoneNumberVerificationInterface.php \Drupal\sms\Provider\PhoneNumberVerificationInterface
  2. 8 src/Entity/PhoneNumberVerificationInterface.php \Drupal\sms\Entity\PhoneNumberVerificationInterface
Same name and namespace in other branches
  1. 2.x src/Provider/PhoneNumberVerificationInterface.php \Drupal\sms\Provider\PhoneNumberVerificationInterface
  2. 2.1.x src/Provider/PhoneNumberVerificationInterface.php \Drupal\sms\Provider\PhoneNumberVerificationInterface

Interface for phone number provider.

Hierarchy

Expanded class hierarchy of PhoneNumberVerificationInterface

All classes that implement PhoneNumberVerificationInterface

7 files declare their use of PhoneNumberVerificationInterface
AccountRegistration.php in modules/sms_user/src/AccountRegistration.php
AdminSettingsForm.php in modules/sms_user/src/Form/AdminSettingsForm.php
PhoneNumberSettingsListBuilder.php in src/Lists/PhoneNumberSettingsListBuilder.php
SmsEntityPhoneNumberProcessor.php in src/EventSubscriber/SmsEntityPhoneNumberProcessor.php
SmsUserMenuLink.php in modules/sms_user/src/Plugin/Derivative/SmsUserMenuLink.php

... See full list

File

src/Provider/PhoneNumberVerificationInterface.php, line 10

Namespace

Drupal\sms\Provider
View source
interface PhoneNumberVerificationInterface {

  /**
   * Gets read only phone number settings config object for a bundle.
   *
   * @param string $entity_type_id
   *   The entity type ID of the bundle.
   * @param string $bundle
   *   An entity bundle.
   *
   * @return \Drupal\sms\Entity\PhoneNumberSettingsInterface|null
   *   A phone number settings entity, or NULL if it does not exist.
   */
  public function getPhoneNumberSettings($entity_type_id, $bundle);

  /**
   * Gets phone number settings for the bundle of an entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity to get settings.
   *
   * @return \Drupal\sms\Entity\PhoneNumberSettingsInterface|null
   *   A phone number settings entity, or NULL if it does not exist.
   *
   * @throws \Drupal\sms\Exception\PhoneNumberSettingsException
   *   Thrown if entity is not configured for phone numbers.
   */
  public function getPhoneNumberSettingsForEntity(EntityInterface $entity);

  /**
   * Checks if there is a phone number verification for a code.
   *
   * @param string $code
   *   A string to check is a verification code.
   *
   * @return \Drupal\sms\Entity\PhoneNumberVerificationInterface|false
   *   A phone number verification entity, or FALSE if $code is not a valid
   *   verification code.
   */
  public function getPhoneVerificationByCode($code);

  /**
   * Gets phone number verifications for a phone number.
   *
   * This is the primary helper to determine if a phone number is in use.
   *
   * It is possible for multiple entities to have the same phone number, so this
   * helper may return more than one phone verification.
   *
   * @param string $phone_number
   *   A phone number.
   * @param bool|null $verified
   *   Whether the returned phone numbers must be verified, or NULL to get all
   *   regardless of status.
   * @param string $entity_type
   *   An entity type ID to filter.
   *
   * @return \Drupal\sms\Entity\PhoneNumberVerificationInterface[]
   *   An array of phone number verification entities, if any.
   */
  public function getPhoneVerificationByPhoneNumber($phone_number, $verified = TRUE, $entity_type = NULL);

  /**
   * Gets a phone number verification for an entity and phone number pair.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   An entity to get phone number verification.
   * @param string $phone_number
   *   A phone number.
   *
   * @return \Drupal\sms\Entity\PhoneNumberVerificationInterface|null
   *   The phone number verification for an entity and phone number pair.
   */
  public function getPhoneVerificationByEntity(EntityInterface $entity, $phone_number);

  /**
   * Generates a phone number verification for an entity and phone number pair.
   *
   * The phone number verification is immediately saved to storage, and an
   * SMS is sent to the phone number for verification.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   An entity to get phone number verification.
   * @param string $phone_number
   *   A phone number.
   *
   * @return \Drupal\sms\Entity\PhoneNumberVerificationInterface|null
   *   A phone number verification.
   */
  public function newPhoneVerification(EntityInterface $entity, $phone_number);

  /**
   * Detect modifications to phone numbers on an entity.
   *
   * Detects if phone numbers are modified on an entity. If new phone numbers
   * are detected, new phone number verifications are created. If phone numbers
   * are removed, the associated phone number verification is deleted.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   Update phone number verifications for this entity.
   */
  public function updatePhoneVerificationByEntity(EntityInterface $entity);

  /**
   * Deletes phone number verifications for an entity.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   Delete phone number verifications for this entity.
   */
  public function deletePhoneVerificationByEntity(EntityInterface $entity);

  /**
   * Cleans up expired phone number verifications.
   *
   * Removes phone numbers from entities if setting is verification expires, and
   * setting is enabled.
   */
  public function purgeExpiredVerifications();

}

Members

Namesort descending Modifiers Type Description Overrides
PhoneNumberVerificationInterface::deletePhoneVerificationByEntity public function Deletes phone number verifications for an entity. 1
PhoneNumberVerificationInterface::getPhoneNumberSettings public function Gets read only phone number settings config object for a bundle. 1
PhoneNumberVerificationInterface::getPhoneNumberSettingsForEntity public function Gets phone number settings for the bundle of an entity. 1
PhoneNumberVerificationInterface::getPhoneVerificationByCode public function Checks if there is a phone number verification for a code. 1
PhoneNumberVerificationInterface::getPhoneVerificationByEntity public function Gets a phone number verification for an entity and phone number pair. 1
PhoneNumberVerificationInterface::getPhoneVerificationByPhoneNumber public function Gets phone number verifications for a phone number. 1
PhoneNumberVerificationInterface::newPhoneVerification public function Generates a phone number verification for an entity and phone number pair. 1
PhoneNumberVerificationInterface::purgeExpiredVerifications public function Cleans up expired phone number verifications. 1
PhoneNumberVerificationInterface::updatePhoneVerificationByEntity public function Detect modifications to phone numbers on an entity. 1