Converter
in package
Laminas\Ldap\Converter is a collection of useful LDAP related conversion functions.
Table of Contents
Constants
- BOOLEAN = 1
- GENERALIZED_TIME = 2
- STANDARD = 0
Methods
- ascToHex32() : string
- Converts all ASCII chars < 32 to "\HEX"
- fromLdap() : mixed
- Convert an LDAP-compatible value to a corresponding PHP-value.
- fromLdapBoolean() : bool
- Convert an LDAP-compatible boolean value into a PHP-compatible one
- fromLdapDateTime() : DateTime
- Convert an LDAP-Generalized-Time-entry into a DateTime-Object
- fromLdapUnserialize() : mixed
- Unserialize a serialized value to return the corresponding object
- hex32ToAsc() : string
- Converts all Hex expressions ("\HEX") to their original ASCII characters
- toLdap() : string|null
- Convert any value to an LDAP-compatible value.
- toLdapBoolean() : string
- Convert a boolean value to an LDAP-compatible string
- toLdapDateTime() : string
- Converts a date-entity to an LDAP-compatible date-string
- toLdapSerialize() : string
- Serialize any value for storage in LDAP
Constants
BOOLEAN
public
mixed
BOOLEAN
= 1
GENERALIZED_TIME
public
mixed
GENERALIZED_TIME
= 2
STANDARD
public
mixed
STANDARD
= 0
Methods
ascToHex32()
Converts all ASCII chars < 32 to "\HEX"
public
static ascToHex32(string $string) : string
Parameters
- $string : string
-
String to convert
Tags
Return values
stringfromLdap()
Convert an LDAP-compatible value to a corresponding PHP-value.
public
static fromLdap(string $value[, int $type = self::STANDARD ][, bool $dateTimeAsUtc = true ]) : mixed
By setting the $type-parameter the conversion of a certain type can be forced.
Parameters
- $value : string
-
The value to convert
- $type : int = self::STANDARD
-
The conversion type to use
- $dateTimeAsUtc : bool = true
-
Return DateTime values in UTC timezone
Tags
fromLdapBoolean()
Convert an LDAP-compatible boolean value into a PHP-compatible one
public
static fromLdapBoolean(string $value) : bool
Parameters
- $value : string
-
The value to convert
Tags
Return values
boolfromLdapDateTime()
Convert an LDAP-Generalized-Time-entry into a DateTime-Object
public
static fromLdapDateTime(string $date[, bool $asUtc = true ]) : DateTime
CAVEAT: The DateTime-Object returned will always be set to UTC-Timezone.
Parameters
- $date : string
-
The generalized-Time
- $asUtc : bool = true
-
Return the DateTime with UTC timezone
Tags
Return values
DateTimefromLdapUnserialize()
Unserialize a serialized value to return the corresponding object
public
static fromLdapUnserialize(string $value) : mixed
Parameters
- $value : string
-
The value to convert
Tags
hex32ToAsc()
Converts all Hex expressions ("\HEX") to their original ASCII characters
public
static hex32ToAsc(string $string) : string
Parameters
- $string : string
-
String to convert
Tags
Return values
stringtoLdap()
Convert any value to an LDAP-compatible value.
public
static toLdap(mixed $value[, int $type = self::STANDARD ]) : string|null
By setting the $type-parameter the conversion of a certain type can be forced
Parameters
- $value : mixed
-
The value to convert
- $type : int = self::STANDARD
-
The conversion type to use
Tags
Return values
string|nulltoLdapBoolean()
Convert a boolean value to an LDAP-compatible string
public
static toLdapBoolean(bool|int|string $value) : 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
- $value : bool|int|string
-
The boolean value to encode
Return values
stringtoLdapDateTime()
Converts a date-entity to an LDAP-compatible date-string
public
static toLdapDateTime(int|string|DateTime $date[, bool $asUtc = true ]) : string
The date-entity $date can be either a timestamp, a DateTime Object, a string that is parseable by strtotime().
Parameters
- $date : int|string|DateTime
-
The date-entity
- $asUtc : bool = true
-
Whether to return the LDAP-compatible date-string as UTC or as local value
Tags
Return values
stringtoLdapSerialize()
Serialize any value for storage in LDAP
public
static toLdapSerialize(mixed $value) : string
Parameters
- $value : mixed
-
The value to serialize