You are here

private function LdapUserProcessor::extractTokenParts in Lightweight Directory Access Protocol (LDAP) 8.3

Extract parts of token.

Parameters

string $token: Token or token expression with singular token in it, eg. [dn], [dn;binary], [titles:0;binary] [cn]@mycompany.com.

Return value

array Array triplet containing [<attr_name>, <ordinal>, <conversion>].

1 call to LdapUserProcessor::extractTokenParts()
LdapUserProcessor::drupalUserToLdapEntry in ldap_user/src/Processor/LdapUserProcessor.php
Populate LDAP entry array for provisioning.

File

ldap_user/src/Processor/LdapUserProcessor.php, line 261

Class

LdapUserProcessor
Processor for LDAP provisioning.

Namespace

Drupal\ldap_user\Processor

Code

private function extractTokenParts($token) {
  $attributes = [];
  ConversionHelper::extractTokenAttributes($attributes, $token);
  if (is_array($attributes)) {
    $keys = array_keys($attributes);
    $attr_name = $keys[0];
    $attr_data = $attributes[$attr_name];
    $ordinals = array_keys($attr_data['values']);
    $ordinal = $ordinals[0];
    return [
      $attr_name,
      $ordinal,
    ];
  }
  else {
    return [
      NULL,
      NULL,
    ];
  }
}