You are here

public function MobileNumberUtil::getToken in Mobile Number 2.0.x

Same name and namespace in other branches
  1. 8 src/MobileNumberUtil.php \Drupal\mobile_number\MobileNumberUtil::getToken()

Gets token generated if verification code was sent.

Parameters

\libphonenumber\PhoneNumber $mobile_number: Phone number object.

Return value

string|null A drupal token (43 characters).

Overrides MobileNumberUtilInterface::getToken

1 call to MobileNumberUtil::getToken()
MobileNumberUtil::verifyCode in src/MobileNumberUtil.php
Verifies input code matches code sent to user.

File

src/MobileNumberUtil.php, line 249

Class

MobileNumberUtil
Turns a render array into a HTML string.

Namespace

Drupal\mobile_number

Code

public function getToken(PhoneNumber $mobile_number) {
  if (!empty($_SESSION['mobile_number_verification'][$this
    ->getCallableNumber($mobile_number)]['token'])) {
    return $_SESSION['mobile_number_verification'][$this
      ->getCallableNumber($mobile_number)]['token'];
  }
  return NULL;
}