/**
* {@inheritdoc}
*/
public function toLdap($guid)
{
$guid = strtolower($guid) === self::AUTO ? LdapUtilities::uuid4() : $guid;
if (!LdapUtilities::isValidGuid($guid)) {
throw new AttributeConverterException(sprintf('The value "%s" is not a valid GUID.', $guid));
}
$guid = (new GUID($guid))->toBinary();
if ($this->getOperationType() == self::TYPE_SEARCH_TO) {
$guid = implode('', preg_filter('/^/', '\\', str_split(bin2hex($guid), 2)));
}
return $guid;
}