LdapTools\Schema\LdapObjectSchema::getAttributeToLdap PHP Method

getAttributeToLdap() public method

Given an attribute name, this will get the attribute that LDAP is expecting for that name.
public getAttributeToLdap ( string $attribute ) : string
$attribute string
return string
    public function getAttributeToLdap($attribute)
    {
        return $this->hasAttribute($attribute) ? MBString::array_change_key_case($this->attributeMap)[MBString::strtolower($attribute)] : $attribute;
    }

Usage Example

 /**
  * Convert values to LDAP.
  *
  * @param array $entry The LDAP entry.
  * @return array
  */
 public function toLdap(array $entry)
 {
     $toLdap = [];
     foreach ($entry as $attribute => $value) {
         $toLdap[$this->schema->getAttributeToLdap($attribute)] = $value;
     }
     return $toLdap;
 }