protected function getComparisonValue($entry, $attribute)
{
$alias = null;
if (!empty($this->aliases)) {
list($alias, $attribute) = LdapUtilities::getAliasAndAttribute($attribute);
}
$value = '';
if (is_array($entry) && isset($entry[$attribute])) {
$value = $entry[$attribute];
// Be forgiving if they are hydrating to an array and the case of the attribute was not correct.
} elseif (is_array($entry) && array_key_exists(MBString::strtolower($attribute), MBString::array_change_key_case($entry))) {
$value = MBString::array_change_key_case($entry)[MBString::strtolower($attribute)];
// Only get the value if there is no alias requested, or if an alias was requested the object type must match the alias.
} elseif ($entry instanceof LdapObject && (!$alias || $entry->isType($this->aliases[$alias]->getObjectType())) && $entry->has($attribute)) {
$value = $entry->get($attribute);
}
// How to handle multi-valued attributes? This will at least prevent errors, but may not be accurate.
$value = is_array($value) ? reset($value) : $value;
return $this->convertValueToString($value);
}