/**
* Set all the names mapped to a single attribute from LDAP. This helps account for multiple mappings used for
* different purposes.
*
* @param array $newEntry
* @param string $attribute
* @param array|string $value
* @return mixed
*/
protected function setMappedNames(array $newEntry, $attribute, $value)
{
// Get all names mapped to this LDAP attribute name...
if (!$this->schema->hasNamesMappedToAttribute($attribute)) {
return $newEntry;
}
$mappedNames = $this->schema->getNamesMappedToAttribute($attribute);
foreach ($mappedNames as $mappedName) {
// Any names specifically selected for should be in the result array...
if ($this->selectedButNotPartOfEntry($mappedName, $newEntry)) {
$newEntry[MBString::array_search_get_value($mappedName, $this->selectedAttributes)] = $value;
}
}
return $newEntry;
}