Ldap/Converter.php

Show: PublicProtectedPrivateinherited
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-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Ldap  
Version
$Id$  

\Zend_Ldap_Converter

Package: Zend_Ldap
Zend_Ldap_Converter is a collection of useful LDAP related conversion functions.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  STANDARD = 0
>VConstant  BOOLEAN = 1
>VConstant  GENERALIZED_TIME = 2

Methods

methodprivate_charHex32ToAsc(array $matches) : string
static

Convert a single slash-prefixed character from Hex32 to ASCII.

Used as a callback in @see hex32ToAsc()
Parameters
NameTypeDescription
$matchesarray
Returns
TypeDescription
string
methodpublicascToHex32(string $string) : string
static

Converts all ASCII chars < 32 to "\HEX"

Parameters
NameTypeDescription
$stringstring

String to convert

Returns
TypeDescription
string
Details
Author
Benedikt Hallinger  
Link
http://pear.php.net/package/Net_LDAP2  
See
from Benedikt Hallinger  
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
NameTypeDescription
$valuestring

The value to convert

$type
$dateTimeAsUtcboolean

Return DateTime values in UTC timezone

Returns
TypeDescription
mixed
Throws
ExceptionDescription
\Zend_Ldap_Converter_Exception
methodpublicfromLdapBoolean(string $value) : boolean
static

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

Parameters
NameTypeDescription
$valuestring

The value to convert

Returns
TypeDescription
boolean
Throws
ExceptionDescription
\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
NameTypeDescription
$datestring

The generalized-Time

$asUtcboolean

Return the DateTime with UTC timezone

Returns
TypeDescription
\DateTime
Throws
ExceptionDescription
\InvalidArgumentExceptionif a non-parseable-format is given
methodpublicfromLdapUnserialize(string $value) : mixed
static

Unserialize a serialized value to return the corresponding object

Parameters
NameTypeDescription
$valuestring

The value to convert

Returns
TypeDescription
mixed
Throws
ExceptionDescription
\UnexpectedValueException
methodpublichex32ToAsc(string $string) : string
static

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

Parameters
NameTypeDescription
$stringstring

String to convert

Returns
TypeDescription
string
Details
Author
Benedikt Hallinger , heavily based on work from DavidSmith@byu.net  
Link
http://pear.php.net/package/Net_LDAP2  
See
from Benedikt Hallinger , heavily based on work from DavidSmith@byu.net  
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
NameTypeDescription
$valuemixed

The value to convert

$type
Returns
TypeDescription
string
Throws
ExceptionDescription
\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
NameTypeDescription
$valueboolean | integer | string

The boolean value to encode

Returns
TypeDescription
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
NameTypeDescription
$dateinteger | string | \DateTimt | \Zend_Date

The date-entity

$asUtcboolean

Whether to return the LDAP-compatible date-string

                                                     as UTC or as local value
Returns
TypeDescription
string
Throws
ExceptionDescription
\InvalidArgumentException
methodpublictoLdapSerialize(mixed $value) : string
static

Serialize any value for storage in LDAP

Parameters
NameTypeDescription
$valuemixed

The value to serialize

Returns
TypeDescription
string
Documentation was generated by phpDocumentor 2.2.0 .