public function fromLdap(array $entry, array $selectedAttributes)
{
$this->selectedAttributes = $this->getSelectedAttributes($selectedAttributes, $entry);
$newEntry = [];
foreach ($entry as $attribute => $value) {
if ($this->schema) {
$newEntry = $this->setMappedNames($newEntry, $attribute, $value);
}
// If the LDAP attribute name was also explicitly selected for, and is not already in the array, add it...
if ($this->selectedButNotPartOfEntry($attribute, $newEntry)) {
$newEntry[MBString::array_search_get_value($attribute, $this->selectedAttributes)] = $value;
}
}
// The DN attribute must be present as it is used in many critical functions.
$newEntry = $this->addDnFromLdapIfNotPresent($newEntry, $entry);
return $newEntry;
}