protected function encodeValues($values)
{
if (is_null($this->connection) || $this->type == AttributeConverterInterface::TYPE_SEARCH_FROM) {
return $values;
}
$encoded = is_array($values) ? $values : [$values];
foreach ($encoded as $index => $value) {
if (is_string($value)) {
$encoded[$index] = LdapUtilities::encode($value, $this->connection->getConfig()->getEncoding());
}
}
// This is to pass it back the same way it was received. ldap_modify_batch is picky about values being an array.
return is_array($values) ? $encoded : reset($encoded);
}