You are here

private function TokenProcessor::tokenizeLdapEntry in Lightweight Directory Access Protocol (LDAP) 8.4

Same name and namespace in other branches
  1. 8.3 ldap_servers/src/Processor/TokenProcessor.php \Drupal\ldap_servers\Processor\TokenProcessor::tokenizeLdapEntry()

Turn an LDAP entry into a token array suitable for the t() function.

Parameters

\Symfony\Component\Ldap\Entry $ldap_entry: The LDAP entry.

array $required_tokens: Tokens requested.

1 call to TokenProcessor::tokenizeLdapEntry()
TokenProcessor::ldapEntryReplacementsForDrupalAccount in ldap_servers/src/Processor/TokenProcessor.php
Replace a single token.

File

ldap_servers/src/Processor/TokenProcessor.php, line 116

Class

TokenProcessor
Helper to manage LDAP tokens and process their content.

Namespace

Drupal\ldap_servers\Processor

Code

private function tokenizeLdapEntry(Entry $ldap_entry, array $required_tokens) : void {
  if (empty($ldap_entry
    ->getAttributes())) {
    $this->detailLog
      ->log('Skipped tokenization of LDAP entry because no LDAP entry provided when called from %calling_function.', [
      '%calling_function' => function_exists('debug_backtrace') ? debug_backtrace()[1]['function'] : 'undefined',
    ]);
    return;
  }
  $this
    ->processDnParts($ldap_entry
    ->getDn());
  $this->tokens['[dn]'] = $ldap_entry
    ->getDn();
  foreach ($required_tokens as $required_token) {
    $this
      ->processLdapTokenKey($ldap_entry, $required_token);
  }
}