API Documentation

Ldap/Converter.php

Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Ldap
version
$Id: Converter.php 22997 2010-09-22 17:04:28Z sgehrig $
Classes
Zend_Ldap_Converter

Description

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.

Zend_Ldap_Converter

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Ldap
Constants
STANDARD
BOOLEAN
GENERALIZED_TIME
Methods
ascToHex32
hex32ToAsc
toLdap
toLdapDateTime
toLdapBoolean
toLdapSerialize
fromLdap
fromLdapDateTime
fromLdapBoolean
fromLdapUnserialize

Description

Zend_Ldap_Converter is a collection of useful LDAP related conversion functions.

Constants

STANDARD

 STANDARD = '0'

Details

value
0

BOOLEAN

 BOOLEAN = '1'

Details

value
1

GENERALIZED_TIME

 GENERALIZED_TIME = '2'

Details

value
2

Methods

ascToHex32

ascToHex32( string $string ) : string

Converts all ASCII chars < 32 to "\HEX"

Arguments
$string
string
String to convert
Output
string
Details
visibility
public
final
false
static
true
author
Benedikt Hallinger <beni@php.net>
link
http://pear.php.net/package/Net_LDAP2
see
Net_LDAP2_Util::asc2hex32() from Benedikt Hallinger <beni@php.net>

fromLdap

fromLdap( string $value,  $type = self, boolean $dateTimeAsUtc = true ) : mixed

Convert an LDAP-compatible value to a corresponding PHP-value.

By setting the $type-parameter the conversion of a certain type can be forced .

Arguments
$value
string
The value to convert
$type
$dateTimeAsUtc
boolean
Return DateTime values in UTC timezone
Output
mixed
Details
visibility
public
final
false
static
true
throws

fromLdapBoolean

fromLdapBoolean( string $value ) : boolean

Convert an LDAP-compatible boolean value into a PHP-compatible one

Arguments
$value
string
The value to convert
Output
boolean
Details
visibility
public
final
false
static
true
throws

fromLdapDateTime

fromLdapDateTime( string $date, boolean $asUtc = true ) : DateTime

Convert an LDAP-Generalized-Time-entry into a DateTime-Object

CAVEAT: The DateTime-Object returned will alwasy be set to UTC-Timezone.

Arguments
$date
string
The generalized-Time
$asUtc
boolean
Return the DateTime with UTC timezone
Output
DateTime
Details
visibility
public
final
false
static
true
throws
if a non-parseable-format is given

fromLdapUnserialize

fromLdapUnserialize( string $value ) : mixed

Unserialize a serialized value to return the corresponding object

Arguments
$value
string
The value to convert
Output
mixed
Details
visibility
public
final
false
static
true
throws

hex32ToAsc

hex32ToAsc( string $string ) : string

Converts all Hex expressions ("\HEX") to their original ASCII characters

Arguments
$string
string
String to convert
Output
string
Details
visibility
public
final
false
static
true
author
Benedikt Hallinger <beni@php.net>, heavily based on work from DavidSmith@byu.net
link
http://pear.php.net/package/Net_LDAP2
see
Net_LDAP2_Util::hex2asc() from Benedikt Hallinger <beni@php.net>, heavily based on work from DavidSmith@byu.net

toLdap

toLdap( mixed $value,  $type = self ) : string

Convert any value to an LDAP-compatible value.

By setting the $type-parameter the conversion of a certain type can be forced

Arguments
$value
mixed
The value to convert
$type
Output
string
Details
visibility
public
final
false
static
true
throws
todo
write more tests

toLdapBoolean

toLdapBoolean( boolean|integer|string $value ) : string

Convert a boolean value to an LDAP-compatible string

This converts a boolean value of TRUE, an integer-value of 1 and a case-insensitive string 'true' to an LDAP-compatible 'TRUE'. All other other values are converted to an LDAP-compatible 'FALSE'.

Arguments
$value
booleanintegerstring
The boolean value to encode
Output
string
Details
visibility
public
final
false
static
true

toLdapDateTime

toLdapDateTime( integer|string|DateTimt|Zend_Date $date, boolean $asUtc = true ) : string

Converts a date-entity to an LDAP-compatible date-string

The date-entity $date can be either a timestamp, a DateTime Object, a string that is parseable by strtotime() or a Zend_Date Object.

Arguments
$date
integerstringDateTimtZend_Date
The date-entity
$asUtc
boolean
Whether to return the LDAP-compatible date-string as UTC or as local value
Output
string
Details
visibility
public
final
false
static
true
throws

toLdapSerialize

toLdapSerialize( mixed $value ) : string

Serialize any value for storage in LDAP

Arguments
$value
mixed
The value to serialize
Output
string
Details
visibility
public
final
false
static
true
Documentation was generated by DocBlox.