DefaultIterator
in package
implements
Iterator, Countable
Laminas\Ldap\Collection\DefaultIterator is the default collection iterator implementation using ext/ldap
Tags
Table of Contents
Interfaces
- Iterator
- Countable
Constants
- ATTRIBUTE_NATIVE = 3
- ATTRIBUTE_TO_LOWER = 1
- ATTRIBUTE_TO_UPPER = 2
Properties
- $attributeNameTreatment : int|callable
- The method that will be applied to the attribute's names.
- $current : resource|null
- Current result entry identifier
- $entries : array<string|int, mixed>
- This array holds a list of resources and sorting-values.
- $itemCount : int
- Number of items in query result
- $ldap : Ldap
- LDAP Connection
- $resultId : resource|null
- Result identifier resource
- $sortFunction : callable
- The function to sort the entries by
Methods
- __construct() : mixed
- __destruct() : mixed
- close() : bool
- Closes the current result set
- count() : mixed
- current() : mixed
- getAttributeNameTreatment() : int|callable
- Returns the currently set attribute name treatment
- getLDAP() : Ldap
- Gets the current LDAP connection.
- key() : mixed
- next() : mixed
- rewind() : mixed
- setAttributeNameTreatment() : DefaultIterator
- Sets the attribute name treatment.
- setSortFunction() : DefaultIterator
- Set a sorting-algorithm for this iterator
- sort() : void
- Sort the iterator
- valid() : mixed
Constants
ATTRIBUTE_NATIVE
public
mixed
ATTRIBUTE_NATIVE
= 3
ATTRIBUTE_TO_LOWER
public
mixed
ATTRIBUTE_TO_LOWER
= 1
ATTRIBUTE_TO_UPPER
public
mixed
ATTRIBUTE_TO_UPPER
= 2
Properties
$attributeNameTreatment
The method that will be applied to the attribute's names.
protected
int|callable
$attributeNameTreatment
= self::ATTRIBUTE_TO_LOWER
$current
Current result entry identifier
protected
resource|null
$current
$entries
This array holds a list of resources and sorting-values.
protected
array<string|int, mixed>
$entries
= []
Each result is represented by an array containing the keys resource which holds a resource of a result-item and the key sortValue which holds the value by which the array will be sorted.
The resources will be filled on creating the instance and the sorting values on sorting.
$itemCount
Number of items in query result
protected
int
$itemCount
= -1
$ldap
LDAP Connection
protected
Ldap
$ldap
$resultId
Result identifier resource
protected
resource|null
$resultId
$sortFunction
The function to sort the entries by
protected
callable
$sortFunction
Methods
__construct()
public
__construct(Ldap $ldap, resource $resultId) : mixed
Parameters
- $ldap : Ldap
- $resultId : resource
Tags
__destruct()
public
__destruct() : mixed
close()
Closes the current result set
public
close() : bool
Return values
boolcount()
public
count() : mixed
Tags
Attributes
current()
public
current() : mixed
Tags
Attributes
getAttributeNameTreatment()
Returns the currently set attribute name treatment
public
getAttributeNameTreatment() : int|callable
Return values
int|callablegetLDAP()
Gets the current LDAP connection.
public
getLDAP() : Ldap
Return values
Ldapkey()
public
key() : mixed
Tags
Attributes
next()
public
next() : mixed
Tags
Attributes
rewind()
public
rewind() : mixed
Tags
Attributes
setAttributeNameTreatment()
Sets the attribute name treatment.
public
setAttributeNameTreatment(int|callable $attributeNameTreatment) : DefaultIterator
Can either be one of the following constants
- Laminas\Ldap\Collection\DefaultIterator::ATTRIBUTE_TO_LOWER
- Laminas\Ldap\Collection\DefaultIterator::ATTRIBUTE_TO_UPPER
- Laminas\Ldap\Collection\DefaultIterator::ATTRIBUTE_NATIVE or a valid callback accepting the attribute's name as it's only argument and returning the new attribute's name.
Parameters
- $attributeNameTreatment : int|callable
Return values
DefaultIterator —Provides a fluent interface
setSortFunction()
Set a sorting-algorithm for this iterator
public
setSortFunction(callable $sortFunction) : DefaultIterator
The callable has to accept two parameters that will be compared.
Parameters
- $sortFunction : callable
-
The algorithm to be used for sorting
Return values
DefaultIterator —Provides a fluent interface
sort()
Sort the iterator
public
sort(string $sortAttribute) : void
Sorting is done using the set sortFunction which is by default strnatcasecmp.
The attribute is determined by lowercasing everything.
The sort-value will be the first value of the attribute.
Parameters
- $sortAttribute : string
-
The attribute to sort by. If not given the value set via setSortAttribute is used.
valid()
public
valid() : mixed