API Documentation

Zend/Ldap/Converter.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: Converter.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Ldap_Converter

Package: Zend\Ldap

Zend_Ldap_Converter is a collection of useful LDAP related conversion functions.

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

Constants

Constant  STANDARD = 0
Constant  BOOLEAN = 1
Constant  GENERALIZED_TIME = 2

Methods

methodpublicascToHex32( string $string ) : string
static

Converts all ASCII chars < 32 to "\HEX"

Parameters
Name Type Description
$string string

String to convert

Returns
Type Description
string
Details
Author
Benedikt Hallinger  
Link
http://pear.php.net/package/Net_LDAP2  
See
\Net_LDAP2_Util::asc2hex32()  
methodpublicfromLdap( string $value,  $type = self::STANDARD, boolean $dateTimeAsUtc = true ) : mixed
static

Convert 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
Type Description
mixed
Throws
Exception Description
\Zend_Ldap_Converter_Exception
methodpublicfromLdapBoolean( string $value ) : boolean
static

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

Parameters
Name Type Description
$value string

The value to convert

Returns
Type Description
boolean
Throws
Exception Description
\InvalidArgumentException
methodpublicfromLdapDateTime( string $date, boolean $asUtc = true ) : \DateTime
static

Convert 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
Type Description
\DateTime
Throws
Exception Description
\InvalidArgumentException if a non-parseable-format is given
methodpublicfromLdapUnserialize( string $value ) : mixed
static

Unserialize a serialized value to return the corresponding object

Parameters
Name Type Description
$value string

The value to convert

Returns
Type Description
mixed
Throws
Exception Description
\UnexpectedValueException
methodpublichex32ToAsc( string $string ) : string
static

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

Parameters
Name Type Description
$string string

String to convert

Returns
Type Description
string
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()  
methodpublictoLdap( mixed $value,  $type = self::STANDARD ) : string
static

Convert 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
Type Description
string
Throws
Exception Description
\Zend_Ldap_Converter_Exception
Details
Todo
write more tests  
methodpublictoLdapBoolean( boolean|integer|string $value ) : string
static

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

Parameters
Name Type Description
$value boolean|integer|string

The boolean value to encode

Returns
Type Description
string
methodpublictoLdapDateTime( integer|string|\DateTimt|\Zend_Date $date, boolean $asUtc = true ) : string
static

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.

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
Type Description
string
Throws
Exception Description
\InvalidArgumentException
methodpublictoLdapSerialize( mixed $value ) : string
static

Serialize any value for storage in LDAP

Parameters
Name Type Description
$value mixed

The value to serialize

Returns
Type Description
string
Documentation was generated by DocBlox 0.15.1.