LdapTools\Utilities\LdapUtilities::implodeDn PHP Метод

implodeDn() публичный статический Метод

Given a DN as an array in ['cn=Name', 'ou=Employees', 'dc=example', 'dc=com'] form, return it as its string representation that is safe to pass back to a query or to save back to LDAP for a DN.
public static implodeDn ( array $dn ) : string
$dn array
Результат string
    public static function implodeDn(array $dn)
    {
        foreach ($dn as $index => $piece) {
            $values = explode('=', $piece, 2);
            if (count($values) === 1) {
                throw new InvalidArgumentException(sprintf('Unable to parse DN piece "%s".', $values[0]));
            }
            $dn[$index] = $values[0] . '=' . self::escapeValue($values[1], null, LDAP_ESCAPE_DN);
        }
        return implode(',', $dn);
    }