PHP Interface Pinq\Iterators\IIteratorScheme

Author: Elliot Levin ([email protected])
Afficher le fichier Open project: timetoogo/pinq Interface Usage Examples

Méthodes publiques

Méthode Description
appendIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return all values from both the supplied iterators.
arrayCompatibleIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will map any non integer or string keys to incrementing integers.
arrayIterator ( array $array ) : Traversable Returns an iterator for the supplied array.
createOrderedMap ( Traversable $iterator = null ) : Pinq\Iterators\IOrderedMap Creates an ordered map from the supplied iterator.
createSet ( Traversable $iterator = null ) : Pinq\Iterators\ISet Creates an set from the supplied iterator values.
differenceIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return uniqe values present in the first but not the second iterator.
emptyIterator ( ) : Traversable Returns an empty iterator.
exceptIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return all values in the first but not present in the second iterator.
filterIterator ( Traversable $iterator, callable $predicate ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will filter the elements according to the supplied predicate function.
flattenedIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will iterate each element of the inner iterator's values. An exception will be thrown if an invalid iterator is returned from the supplied iterator.
groupJoinIterator ( Traversable $outerIterator, Traversable $innerIterator, callable $traversableFactory ) : Pinq\Iterators\IJoinIterator Returns an iterator which will return the outer elements joined to the inner elements. All matched inner elements for each outer element will be wrapped in a traversable implementation from the supplied factory.
groupedIterator ( Traversable $iterator, callable $groupKeyFunction, callable $traversableFactory ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will group the elements according to the supplied function and wrap each group in a traversable implementation from the supplied factory.
intersectionIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return unique values present in the first and second iterator.
joinIterator ( Traversable $outerIterator, Traversable $innerIterator ) : Pinq\Iterators\IJoinIterator Returns an iterator which will return the outer elements joined to the inner elements.
orderedIterator ( Traversable $iterator, callable $function, boolean $isAscending ) : Pinq\Iterators\IOrderedIterator Returns an iterator with will sort the elements according to the supplied function and direction.
projectionIterator ( Traversable $iterator, callable $keyProjectionFunction = null, callable $valueProjectionFunction = null ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return the elements mapped by the supplied functions or the original if no function is supplied.
rangeIterator ( Traversable $iterator, integer $start, integer | null $amount ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will only iterate the elements in the supplied range.
reindexerIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return the map the keys to 0-based incrementing integers
toArray ( Traversable $iterator ) : array Safely converts the supplied iterator to an array.
toIterator ( Traversable | array $traversableOrArray ) : Traversable Returns the supplied traversable or array as an iterator compatible with this scheme.
unionIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return unique values present in the first or second iterator.
uniqueIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return unique values using strict equality.
uniqueKeyIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return only the first associated value for any key.
walk ( Traversable $iterator, callable $function ) : void Iterate over the keys and values of the supplied iterator and passes them (value, key) to the supplied function.
whereInIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator Returns an iterator which will return all values in the first iterator present in the second.

Method Details

appendIterator() public méthode

Returns an iterator which will return all values from both the supplied iterators.
public appendIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$otherIterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

arrayCompatibleIterator() public méthode

Returns an iterator which will map any non integer or string keys to incrementing integers.
public arrayCompatibleIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

arrayIterator() public méthode

Returns an iterator for the supplied array.
public arrayIterator ( array $array ) : Traversable
$array array
Résultat Traversable

createOrderedMap() public méthode

Keys can only be associated with a single value and such if the iterator returns duplicate keys the last respective value will be used.
public createOrderedMap ( Traversable $iterator = null ) : Pinq\Iterators\IOrderedMap
$iterator Traversable
Résultat Pinq\Iterators\IOrderedMap

createSet() public méthode

A set can only contain unique values and such duplicates will be lost.
public createSet ( Traversable $iterator = null ) : Pinq\Iterators\ISet
$iterator Traversable
Résultat Pinq\Iterators\ISet

differenceIterator() public méthode

Returns an iterator which will return uniqe values present in the first but not the second iterator.
public differenceIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$otherIterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

emptyIterator() public méthode

Returns an empty iterator.
public emptyIterator ( ) : Traversable
Résultat Traversable

exceptIterator() public méthode

Returns an iterator which will return all values in the first but not present in the second iterator.
public exceptIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$otherIterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

filterIterator() public méthode

Returns an iterator which will filter the elements according to the supplied predicate function.
public filterIterator ( Traversable $iterator, callable $predicate ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$predicate callable
Résultat Pinq\Iterators\IWrapperIterator

flattenedIterator() public méthode

Returns an iterator which will iterate each element of the inner iterator's values. An exception will be thrown if an invalid iterator is returned from the supplied iterator.
public flattenedIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

groupJoinIterator() public méthode

Returns an iterator which will return the outer elements joined to the inner elements. All matched inner elements for each outer element will be wrapped in a traversable implementation from the supplied factory.
public groupJoinIterator ( Traversable $outerIterator, Traversable $innerIterator, callable $traversableFactory ) : Pinq\Iterators\IJoinIterator
$outerIterator Traversable
$innerIterator Traversable
$traversableFactory callable
Résultat Pinq\Iterators\IJoinIterator

groupedIterator() public méthode

Returns an iterator which will group the elements according to the supplied function and wrap each group in a traversable implementation from the supplied factory.
public groupedIterator ( Traversable $iterator, callable $groupKeyFunction, callable $traversableFactory ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$groupKeyFunction callable
$traversableFactory callable
Résultat Pinq\Iterators\IWrapperIterator

intersectionIterator() public méthode

Returns an iterator which will return unique values present in the first and second iterator.
public intersectionIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$otherIterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

joinIterator() public méthode

Returns an iterator which will return the outer elements joined to the inner elements.
public joinIterator ( Traversable $outerIterator, Traversable $innerIterator ) : Pinq\Iterators\IJoinIterator
$outerIterator Traversable
$innerIterator Traversable
Résultat Pinq\Iterators\IJoinIterator

orderedIterator() public méthode

Returns an iterator with will sort the elements according to the supplied function and direction.
public orderedIterator ( Traversable $iterator, callable $function, boolean $isAscending ) : Pinq\Iterators\IOrderedIterator
$iterator Traversable
$function callable
$isAscending boolean
Résultat Pinq\Iterators\IOrderedIterator

projectionIterator() public méthode

Returns an iterator which will return the elements mapped by the supplied functions or the original if no function is supplied.
public projectionIterator ( Traversable $iterator, callable $keyProjectionFunction = null, callable $valueProjectionFunction = null ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$keyProjectionFunction callable
$valueProjectionFunction callable
Résultat Pinq\Iterators\IWrapperIterator

rangeIterator() public méthode

Returns an iterator which will only iterate the elements in the supplied range.
public rangeIterator ( Traversable $iterator, integer $start, integer | null $amount ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$start integer
$amount integer | null
Résultat Pinq\Iterators\IWrapperIterator

reindexerIterator() public méthode

Returns an iterator which will return the map the keys to 0-based incrementing integers
public reindexerIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

toArray() public méthode

Non integer or string keys will be reindexed to respective incremented integers.
public toArray ( Traversable $iterator ) : array
$iterator Traversable
Résultat array

toIterator() public méthode

Returns the supplied traversable or array as an iterator compatible with this scheme.
public toIterator ( Traversable | array $traversableOrArray ) : Traversable
$traversableOrArray Traversable | array
Résultat Traversable

unionIterator() public méthode

Returns an iterator which will return unique values present in the first or second iterator.
public unionIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$otherIterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

uniqueIterator() public méthode

Returns an iterator which will return unique values using strict equality.
public uniqueIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

uniqueKeyIterator() public méthode

Returns an iterator which will return only the first associated value for any key.
public uniqueKeyIterator ( Traversable $iterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
Résultat Pinq\Iterators\IWrapperIterator

walk() public méthode

Iterate over the keys and values of the supplied iterator and passes them (value, key) to the supplied function.
public walk ( Traversable $iterator, callable $function ) : void
$iterator Traversable
$function callable
Résultat void

whereInIterator() public méthode

Returns an iterator which will return all values in the first iterator present in the second.
public whereInIterator ( Traversable $iterator, Traversable $otherIterator ) : Pinq\Iterators\IWrapperIterator
$iterator Traversable
$otherIterator Traversable
Résultat Pinq\Iterators\IWrapperIterator