1087. Class

1087.1. Zend\Ldap\Dn

ZendLdapDn provides an API for DN manipulation

1087.1.1. Methods

1087.1.1.1. factory

factory()

Creates a DN from an array or a string

Parameters:
  • string|array
  • string|null
Return type:

Dn

Throws :

ExceptionLdapException

1087.1.1.2. fromString

fromString()

Creates a DN from a string

Parameters:
  • string
  • string|null
Return type:

Dn

Throws :

ExceptionLdapException

1087.1.1.3. fromArray

fromArray()

Creates a DN from an array

Parameters:
  • array
  • string|null
Return type:

Dn

Throws :

ExceptionLdapException

1087.1.1.4. __construct

__construct()

Constructor

Parameters:
  • array
  • string|null

1087.1.1.5. getRdn

getRdn()

Gets the RDN of the current DN

Parameters:string
Return type:array
Throws :ExceptionLdapException if DN has no RDN (empty array)

1087.1.1.6. getRdnString

getRdnString()

Gets the RDN of the current DN as a string

Parameters:string
Return type:string
Throws :ExceptionLdapException if DN has no RDN (empty array)

1087.1.1.7. getParentDn

getParentDn()

Get the parent DN $levelUp levels up the tree

Parameters:int
Throws ExceptionLdapException:
 
Return type:Dn

1087.1.1.8. get

get()

Get a DN part

Parameters:
  • int
  • int
  • string
Return type:

array

Throws :

ExceptionLdapException if index is illegal

1087.1.1.9. set

set()

Set a DN part

Parameters:
  • int
  • array
Return type:

Dn Provides a fluent interface

Throws :

ExceptionLdapException if index is illegal

1087.1.1.10. remove

remove()

Remove a DN part

Parameters:
  • int
  • int
Return type:

Dn Provides a fluent interface

Throws :

ExceptionLdapException if index is illegal

1087.1.1.11. append

append()

Append a DN part

Parameters:array
Return type:Dn Provides a fluent interface

1087.1.1.12. prepend

prepend()

Prepend a DN part

Parameters:array
Return type:Dn Provides a fluent interface

1087.1.1.13. insert

insert()

Insert a DN part

Parameters:
  • int
  • array
Return type:

Dn Provides a fluent interface

Throws :

ExceptionLdapException if index is illegal

1087.1.1.14. assertIndex

assertIndex()

Assert index is correct and usable

Parameters:mixed
Return type:bool
Throws :ExceptionLdapException

1087.1.1.15. assertRdn

assertRdn()

Assert if value is in a correct RDN format

Parameters:array
Return type:bool
Throws :ExceptionLdapException

1087.1.1.16. setCaseFold

setCaseFold()

Sets the case fold

Parameters:string|null

1087.1.1.17. toString

toString()

Return DN as a string

Parameters:string
Return type:string
Throws :ExceptionLdapException

1087.1.1.18. toArray

toArray()

Return DN as an array

Parameters:string
Return type:array

1087.1.1.19. caseFoldRdn

caseFoldRdn()

Do a case folding on a RDN

Parameters:
  • array
  • string
Return type:

array

1087.1.1.20. caseFoldDn

caseFoldDn()

Do a case folding on a DN ort part of it

Parameters:
  • array
  • string
Return type:

array

1087.1.1.21. __toString

__toString()

Cast to string representation {@see toString()}

Return type:string

1087.1.1.22. offsetExists

offsetExists()

Required by the ArrayAccess implementation

Parameters:int
Return type:bool

1087.1.1.23. offsetGet

offsetGet()

Proxy to {@see get()} Required by the ArrayAccess implementation

Parameters:int
Return type:array

1087.1.1.24. offsetSet

offsetSet()

Proxy to {@see set()} Required by the ArrayAccess implementation

Parameters:
  • int
  • array

1087.1.1.25. offsetUnset

offsetUnset()

Proxy to {@see remove()} Required by the ArrayAccess implementation

Parameters:int

1087.1.1.26. setDefaultCaseFold

setDefaultCaseFold()

Sets the default case fold

Parameters:string

1087.1.1.27. sanitizeCaseFold

sanitizeCaseFold()

Sanitizes the case fold

Parameters:
  • string
  • string
Return type:

string

1087.1.1.28. escapeValue

escapeValue()

Escapes a DN value according to RFC 2253

Escapes the given VALUES according to RFC 2253 so that they can be safely used in LDAP DNs. The characters ”,”, “+”, “””, “”, “<”, “>”, ”;”, “#”, ” = ” with a special meaning in RFC 2252 are preceeded by ba backslash. Control characters with an ASCII code < 32 are represented as hexpair. Finally all leading and trailing spaces are converted to sequences of 20.

Parameters:string|array – An array containing the DN values that should be escaped
Return type:array The array $values, but escaped

1087.1.1.29. unescapeValue

unescapeValue()

Undoes the conversion done by {@link escapeValue()}.

Any escape sequence starting with a baskslash - hexpair or special character - will be transformed back to the corresponding character.

Parameters:string|array – Array of DN Values
Return type:array Same as $values, but unescaped

1087.1.1.30. explodeDn

explodeDn()

Creates an array containing all parts of the given DN.

Array will be of type array(

array(“cn” => “name1”, “uid” => “user”), array(“cn” => “name2”), array(“dc” => “example”), array(“dc” => “org”)

) for a DN of cn=name1+uid=user,cn=name2,dc=example,dc=org.

Parameters:
  • string
  • array – An optional array to receive DN keys (e.g. CN, OU, DC, ...)
  • array – An optional array to receive DN values
  • string
Return type:

array

Throws :

ExceptionLdapException

1087.1.1.31. checkDn

checkDn()

@param string $dn The DN to parse

Parameters:
  • array – An optional array to receive DN keys (e.g. CN, OU, DC, ...)
  • array – An optional array to receive DN values
  • string
Return type:

bool True if the DN was successfully parsed or false if the string is not a valid DN.

1087.1.1.32. implodeRdn

implodeRdn()

Returns a DN part in the form $attribute = $value

This method supports the creation of multi-valued RDNs $part must contain an even number of elements.

Parameters:
  • array
  • string
Return type:

string

Throws :

ExceptionLdapException

1087.1.1.33. implodeDn

implodeDn()

Implodes an array in the form delivered by {@link explodeDn()} to a DN string.

$dnArray must be of type array(

array(“cn” => “name1”, “uid” => “user”), array(“cn” => “name2”), array(“dc” => “example”), array(“dc” => “org”)

)

Parameters:
  • array
  • string
  • string
Return type:

string

Throws :

ExceptionLdapException

1087.1.1.34. isChildOf

isChildOf()

Checks if given $childDn is beneath $parentDn subtree.

Parameters:
  • string|Dn
  • string|Dn
Return type:

bool

1087.1.2. Constants

1087.1.2.1. ATTR_CASEFOLD_NONE

1087.1.2.2. ATTR_CASEFOLD_UPPER

1087.1.2.3. ATTR_CASEFOLD_LOWER