API Documentation

Zend/Ldap/Dn.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Ldap  
Version
$Id: Dn.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Ldap_Dn

Package: Zend\Ldap

Zend_Ldap_Dn provides an API for DN manipulation

Implements
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  ATTR_CASEFOLD_NONE = 'none'
Constant  ATTR_CASEFOLD_UPPER = 'upper'
Constant  ATTR_CASEFOLD_LOWER = 'lower'

Properties

Propertyprotectedstring  $_caseFold= ''

The case fold used for this instance

Details
Type
string
Propertyprotectedstring  $_defaultCaseFold= 'self::ATTR_CASEFOLD_NONE'
static

The default case fold to use

Default valueself::ATTR_CASEFOLD_NONEDetails
Type
string
Propertyprotectedarray  $_dn= ''

The DN data

Details
Type
array

Methods

methodprotected__construct( array $dn, string|null $caseFold ) : void

Constructor

Parameters
Name Type Description
$dn array
$caseFold string|null
methodpublic__toString( ) : string

Cast to string representation {@see toString()}

Returns
Type Description
string
methodprotected_assertIndex( mixed $index ) : boolean

Assert index is correct and usable

Parameters
Name Type Description
$index mixed
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Ldap_Exception
methodprotected_assertRdn( array $value ) : boolean
static

Assert if value is in a correct RDN format

Parameters
Name Type Description
$value array
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Ldap_Exception
methodprotected_caseFoldDn( array $dn, string $caseFold ) : array
static

Do a case folding on a DN ort part of it

Parameters
Name Type Description
$dn array
$caseFold string
Returns
Type Description
array
methodprotected_caseFoldRdn( array $part, string $caseFold ) : array
static

Do a case folding on a RDN

Parameters
Name Type Description
$part array
$caseFold string
Returns
Type Description
array
methodprotected_sanitizeCaseFold( string $caseFold,  $default ) : string
static

Sanitizes the case fold

Parameters
Name Type Description
$caseFold string
$default
Returns
Type Description
string
methodpublicappend( array $value ) : \Zend_Ldap_Dn

Append a DN part

Parameters
Name Type Description
$value array
Returns
Type Description
\Zend_Ldap_Dn Provides a fluent interface
methodpubliccheckDn( string $dn, array $keys = null, array $vals = null, string $caseFold = self::ATTR_CASEFOLD_NONE ) : boolean
static

Parameters
Name Type Description
$dn string

The DN to parse

$keys array

An optional array to receive DN keys (e.g. CN, OU, DC, ...)

$vals array

An optional array to receive DN values

$caseFold string
Returns
Type Description
boolean True if the DN was successfully parsed or false if the string is not a valid DN.
methodpublicescapeValue( string|array $values = array() ) : array
static

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
Name Type Description
$values string|array

An array containing the DN values that should be escaped

Returns
Type Description
array The array $values, but escaped
Details
Author
Benedikt Hallinger  
Link
http://pear.php.net/package/Net_LDAP2  
See
\Net_LDAP2_Util::escape_dn_value()  
methodpublicexplodeDn( string $dn, array $keys = null, array $vals = null, string $caseFold = self::ATTR_CASEFOLD_NONE ) : array
static

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
Name Type Description
$dn string
$keys array

An optional array to receive DN keys (e.g. CN, OU, DC, ...)

$vals array

An optional array to receive DN values

$caseFold string
Returns
Type Description
array
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicfactory( string|array $dn, string|null $caseFold = null ) : \Zend_Ldap_Dn
static

Creates a DN from an array or a string

Parameters
Name Type Description
$dn string|array
$caseFold string|null
Returns
Type Description
\Zend_Ldap_Dn
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicfromArray( array $dn, string|null $caseFold = null ) : \Zend_Ldap_Dn
static

Creates a DN from an array

Parameters
Name Type Description
$dn array
$caseFold string|null
Returns
Type Description
\Zend_Ldap_Dn
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicfromString( string $dn, string|null $caseFold = null ) : \Zend_Ldap_Dn
static

Creates a DN from a string

Parameters
Name Type Description
$dn string
$caseFold string|null
Returns
Type Description
\Zend_Ldap_Dn
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicget( int $index, int $length = 1, string $caseFold = null ) : array

Get a DN part

Parameters
Name Type Description
$index int
$length int
$caseFold string
Returns
Type Description
array
Throws
Exception Description
\Zend_Ldap_Exception if index is illegal
methodpublicgetParentDn( int $levelUp = 1 ) : \Zend_Ldap_Dn

Get the parent DN $levelUp levels up the tree

Parameters
Name Type Description
$levelUp int
Returns
Type Description
\Zend_Ldap_Dn
methodpublicgetRdn( string $caseFold = null ) : array

Gets the RDN of the current DN

Parameters
Name Type Description
$caseFold string
Returns
Type Description
array
Throws
Exception Description
\Zend_Ldap_Exception if DN has no RDN (empty array)
methodpublicgetRdnString( string $caseFold = null ) : string

Gets the RDN of the current DN as a string

Parameters
Name Type Description
$caseFold string
Returns
Type Description
string
Throws
Exception Description
\Zend_Ldap_Exception if DN has no RDN (empty array)
methodpublicimplodeDn( array $dnArray, string $caseFold = null, string $separator = ',' ) : string
static

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
Name Type Description
$dnArray array
$caseFold string
$separator string
Returns
Type Description
string
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicimplodeRdn(  $part, string $caseFold = null ) : string
static

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 elemets.

Parameters
Name Type Description
$part
$caseFold string
Returns
Type Description
string
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicinsert( int $index, array $value ) : \Zend_Ldap_Dn

Insert a DN part

Parameters
Name Type Description
$index int
$value array
Returns
Type Description
\Zend_Ldap_Dn Provides a fluent interface
Throws
Exception Description
\Zend_Ldap_Exception if index is illegal
methodpublicisChildOf( string|\Zend_Ldap_Dn $childDn, string|\Zend_Ldap_Dn $parentDn ) : boolean
static

Checks if given $childDn is beneath $parentDn subtree.

Parameters
Name Type Description
$childDn string|\Zend_Ldap_Dn
$parentDn string|\Zend_Ldap_Dn
Returns
Type Description
boolean
Details
Used_by
\Zend_Ldap_Node::attachLdap()  
methodpublicoffsetExists( int $offset ) : boolean

Required by the ArrayAccess implementation

Parameters
Name Type Description
$offset int
Returns
Type Description
boolean
methodpublicoffsetGet( int $offset ) : array

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

Parameters
Name Type Description
$offset int
Returns
Type Description
array
methodpublicoffsetSet( int $offset, array $value ) : void

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

Parameters
Name Type Description
$offset int
$value array
methodpublicoffsetUnset( int $offset ) : void

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

Parameters
Name Type Description
$offset int
methodpublicprepend( array $value ) : \Zend_Ldap_Dn

Prepend a DN part

Parameters
Name Type Description
$value array
Returns
Type Description
\Zend_Ldap_Dn Provides a fluent interface
methodpublicremove( int $index, int $length = 1 ) : \Zend_Ldap_Dn

Remove a DN part

Parameters
Name Type Description
$index int
$length int
Returns
Type Description
\Zend_Ldap_Dn Provides a fluent interface
Throws
Exception Description
\Zend_Ldap_Exception if index is illegal
methodpublicset( int $index, array $value ) : \Zend_Ldap_Dn

Set a DN part

Parameters
Name Type Description
$index int
$value array
Returns
Type Description
\Zend_Ldap_Dn Provides a fluent interface
Throws
Exception Description
\Zend_Ldap_Exception if index is illegal
methodpublicsetCaseFold( string|null $caseFold ) : void

Sets the case fold

Parameters
Name Type Description
$caseFold string|null
methodpublicsetDefaultCaseFold( string $caseFold ) : void
static

Sets the default case fold

Parameters
Name Type Description
$caseFold string
methodpublictoArray( string $caseFold = null ) : array

Return DN as an array

Parameters
Name Type Description
$caseFold string
Returns
Type Description
array
methodpublictoString( string $caseFold = null ) : string

Return DN as a string

Parameters
Name Type Description
$caseFold string
Returns
Type Description
string
Throws
Exception Description
\Zend_Ldap_Exception
methodpublicunescapeValue( string|array $values = array() ) : array
static

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
Name Type Description
$values string|array

Array of DN Values

Returns
Type Description
array Same as $values, but unescaped
Details
Author
Benedikt Hallinger  
Link
http://pear.php.net/package/Net_LDAP2  
See
\Net_LDAP2_Util::escape_dn_value()  
Documentation was generated by DocBlox 0.15.1.