You are here

public function PhoneNumberVerification::getPhoneVerificationByPhoneNumber in SMS Framework 8

Same name and namespace in other branches
  1. 2.x src/Provider/PhoneNumberVerification.php \Drupal\sms\Provider\PhoneNumberVerification::getPhoneVerificationByPhoneNumber()
  2. 2.1.x src/Provider/PhoneNumberVerification.php \Drupal\sms\Provider\PhoneNumberVerification::getPhoneVerificationByPhoneNumber()

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.

Parameters

string $phone_number: A phone number.

bool|null $verified: Whether the returned phone numbers must be verified, or NULL to get all regardless of status.

string $entity_type: An entity type ID to filter.

Return value

\Drupal\sms\Entity\PhoneNumberVerificationInterface[] An array of phone number verification entities, if any.

Overrides PhoneNumberVerificationInterface::getPhoneVerificationByPhoneNumber

File

src/Provider/PhoneNumberVerification.php, line 110

Class

PhoneNumberVerification
Phone number verification provider.

Namespace

Drupal\sms\Provider

Code

public function getPhoneVerificationByPhoneNumber($phone_number, $verified = TRUE, $entity_type = NULL) {
  $properties['phone'] = $phone_number;
  if (isset($entity_type)) {
    $properties['entity__target_type'] = $entity_type;
  }
  if (isset($verified)) {
    $properties['status'] = (int) $verified;
  }
  return $this->phoneNumberVerificationStorage
    ->loadByProperties($properties);
}