Ldap/Converter.php
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-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Ldap
- version
- $Id: Converter.php 24354 2011-08-05 07:36:38Z sgehrig $
Zend_Ldap_Converter is a collection of useful LDAP related conversion functions.
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Ldap
Constants
Methods



fromLdap(
string $value, $type
=
self, boolean $dateTimeAsUtc
=
true
)
:
mixed
staticConvert an LDAP-compatible value to a corresponding PHP-value.
By setting the $type-parameter the conversion of a certain
type can be forced
.
Parameters
Name |
Type |
Description |
$value |
string |
The value to convert |
$type |
|
|
$dateTimeAsUtc |
boolean |
Return DateTime values in UTC timezone |
Returns
Throws



fromLdapBoolean(
string $value
)
:
boolean
staticConvert an LDAP-compatible boolean value into a PHP-compatible one
Parameters
Name |
Type |
Description |
$value |
string |
The value to convert |
Returns
Throws



fromLdapDateTime(
string $date, boolean $asUtc
=
true
)
:
\DateTime
staticConvert an LDAP-Generalized-Time-entry into a DateTime-Object
CAVEAT: The DateTime-Object returned will alwasy be set to UTC-Timezone.
Parameters
Name |
Type |
Description |
$date |
string |
The generalized-Time
|
$asUtc |
boolean |
Return the DateTime with UTC timezone |
Returns
Throws



fromLdapUnserialize(
string $value
)
:
mixed
staticUnserialize a serialized value to return the corresponding object
Parameters
Name |
Type |
Description |
$value |
string |
The value to convert |
Returns
Throws



hex32ToAsc(
string $string
)
:
string
staticConverts all Hex expressions ("\HEX") to their original ASCII characters
Parameters
Name |
Type |
Description |
$string |
string |
String to convert |
Returns
Details
- author
- Benedikt Hallinger , heavily based on work from DavidSmith@byu.net
- link
-
http://pear.php.net/package/Net_LDAP2
- see
- \Net_LDAP2_Util::hex2asc()



toLdap(
mixed $value, $type
=
self
)
:
string
staticConvert any value to an LDAP-compatible value.
By setting the $type-parameter the conversion of a certain
type can be forced
Parameters
Name |
Type |
Description |
$value |
mixed |
The value to convert |
$type |
|
|
Returns
Throws
Details
- todo
- write more tests



toLdapBoolean(
boolean|integer|string $value
)
:
string
staticConvert 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'.
Parameters
Name |
Type |
Description |
$value |
boolean|integer|string |
The boolean value to encode |
Returns



toLdapDateTime(
integer|string|\DateTimt|\Zend_Date $date, boolean $asUtc
=
true
)
:
string
staticConverts 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.
Parameters
Name |
Type |
Description |
$date |
integer|string|\DateTimt|\Zend_Date
|
The date-entity
|
$asUtc |
boolean |
Whether to return the LDAP-compatible date-string as UTC or as local value
|
Returns
Throws



toLdapSerialize(
mixed $value
)
:
string
staticSerialize any value for storage in LDAP
Parameters
Name |
Type |
Description |
$value |
mixed |
The value to serialize |
Returns