/** * Returns the LDAP filter that will be applied * * @string */ protected function render() { $parts = array(); if (!isset($this->filters['objectClass']) || $this->filters['objectClass'] === null) { // throw new Exception('Object class is mandatory'); } foreach ($this->filters as $key => $value) { $parts[] = sprintf('%s=%s', LdapUtils::quoteForSearch($key), LdapUtils::quoteForSearch($value, true)); } if (count($parts) > 1) { return '(&(' . implode(')(', $parts) . '))'; } else { return '(' . $parts[0] . ')'; } }