You are here

public static function ConversionHelper::binaryConversionToString in Lightweight Directory Access Protocol (LDAP) 8.3

General binary conversion function for GUID.

Tries to determine which approach based on length of string.

Parameters

string $value: GUID.

Return value

string Encoded string.

3 calls to ConversionHelper::binaryConversionToString()
ConversionHelper::convertAttribute in ldap_servers/src/Helper/ConversionHelper.php
Converts an attribute by their format.
Server::userPuidFromLdapEntry in ldap_servers/src/Entity/Server.php
Fetches the persistent UID from the LDAP entry.
TokenTests::testTokenReplacement in ldap_servers/tests/src/Unit/TokenTests.php
Test the replacement of tokens.

File

ldap_servers/src/Helper/ConversionHelper.php, line 328

Class

ConversionHelper
Conversion helper to escape values correctly for LDAP filters.

Namespace

Drupal\ldap_servers\Helper

Code

public static function binaryConversionToString($value) {
  if (strlen($value) == 16) {
    $value = self::convertMsguidToString($value);
  }
  else {
    $value = bin2hex($value);
  }
  return $value;
}