PHP Interface Pinq\ITraversable

Query calls must be immutable and return a new instance with every query call. Queries should also be executed lazily upon iteration.
Author: Elliot Levin ([email protected])
Inheritance: extends pinq\IAggregatable, extends IteratorAggregate, extends ArrayAccess
Afficher le fichier Open project: timetoogo/pinq Interface Usage Examples

Méthodes publiques

Méthode Description
append ( array | Traversable $values ) : pinq\ITraversable Returns values from the original and supplied values, keys will be reindexed.
asArray ( ) : array Returns the values as an array.
asCollection ( ) : pinq\ICollection Returns the values as a collection.
asTraversable ( ) : pinq\ITraversable Returns the values as a traversable.
contains ( mixed $value ) : boolean Returns whether the supplied value is contained within the aggregate
difference ( array | Traversable $values ) : pinq\ITraversable Returns unique values from the original not present in the supplied values.
except ( array | Traversable $values ) : pinq\ITraversable Returns values all values from the original not present in the supplied values.
first ( ) : mixed Returns the first value, null if empty
getIterator ( ) : Traversable Returns an array compatible iterator for the elements.
getIteratorScheme ( ) : Pinq\Iterators\IIteratorScheme Returns the underlying iterator scheme used by the implementation.
getSource ( ) : pinq\ITraversable Returns the source traversable or itself if the current traversable is the source.
getTrueIterator ( ) : Traversable Returns an iterator for all the elements.
groupBy ( callable $function ) : pinq\ITraversable Groups values according the supplied function. (Uses strict equality '===') The values will be grouped into instances of the traversable.
groupJoin ( array | Traversable $values ) : Pinq\Interfaces\IJoiningOnTraversable Matches the values with the supplied values according to the supplied filter, groups the the joined values for every original and then maps into as according to the supplied function.
indexBy ( callable $function ) : pinq\ITraversable Index the values according to the supplied mapping function.
intersect ( array | Traversable $values ) : pinq\ITraversable Returns unique values the are present in the original and supplied values.
isSource ( ) : boolean Returns whether the traversable is the source of the elements.
iterate ( callable $function ) : void Iterates the elements with the supplied function.
join ( array | Traversable $values ) : Pinq\Interfaces\IJoiningOnTraversable Matches the values with the supplied values according to the supplied filter then maps the results into as according to the supplied function.
keys ( ) : pinq\ITraversable Selects the keys as the values (indexed by their 0-based position).
last ( ) : mixed Returns the last value, null if empty
orderBy ( callable $function, integer $direction ) : Pinq\Interfaces\IOrderedTraversable Orders the values mapped from the supplied function according the supplied direction.
orderByAscending ( callable $function ) : Pinq\Interfaces\IOrderedTraversable Orders the values mapped from the supplied function ascendingly Example function:
orderByDescending ( callable $function ) : Pinq\Interfaces\IOrderedTraversable Orders the values mapped from the supplied function descendingly Example expression function:
reindex ( ) : pinq\ITraversable Indexes the values by their 0-based position.
select ( callable $function ) : pinq\ITraversable Returns the values mapped by the supplied function.
selectMany ( callable $function ) : pinq\ITraversable Returns the values mapped by the supplied function and then flattens the values into a single traversable. Keys will be reindexed.
skip ( integer $amount ) : pinq\ITraversable Skip the amount of values from the start.
slice ( integer $start, integer | null $amount ) : pinq\ITraversable Retrieve a slice of the values.
take ( integer | null $amount ) : pinq\ITraversable Limits the amount of values by the supplied amount
union ( array | Traversable $values ) : pinq\ITraversable Returns unique results present in both the original and supplied values, keys will be reindexed.
unique ( ) : pinq\ITraversable Only return unique values. (Uses strict equality '===')
where ( callable $predicate ) : pinq\ITraversable Filters the values by a supplied predicate.
whereIn ( array | Traversable $values ) : pinq\ITraversable Returns all values from the original present in the supplied values.

Method Details

append() public méthode

Returns values from the original and supplied values, keys will be reindexed.
public append ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to append
Résultat pinq\ITraversable

asArray() public méthode

Only valid array keys (strings or integers) will be used, all others will be reindexed numerically.
public asArray ( ) : array
Résultat array

asCollection() public méthode

The following queries will be performed in memory.
public asCollection ( ) : pinq\ICollection
Résultat pinq\ICollection

asTraversable() public méthode

The following queries will be performed in memory.
public asTraversable ( ) : pinq\ITraversable
Résultat pinq\ITraversable

contains() public méthode

Returns whether the supplied value is contained within the aggregate
public contains ( mixed $value ) : boolean
$value mixed The value to check for
Résultat boolean

difference() public méthode

(Uses strict equality '===')
public difference ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to remove
Résultat pinq\ITraversable

except() public méthode

(Uses strict equality '===')
public except ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to union
Résultat pinq\ITraversable

first() public méthode

Returns the first value, null if empty
public first ( ) : mixed
Résultat mixed The first value

getIterator() public méthode

Non string or integer keys will be numerically reindexed.
public getIterator ( ) : Traversable
Résultat Traversable

getIteratorScheme() public méthode

Returns the underlying iterator scheme used by the implementation.
public getIteratorScheme ( ) : Pinq\Iterators\IIteratorScheme
Résultat Pinq\Iterators\IIteratorScheme

getSource() public méthode

Returns the source traversable or itself if the current traversable is the source.
public getSource ( ) : pinq\ITraversable
Résultat pinq\ITraversable

getTrueIterator() public méthode

All keys types will remain unaltered.
public getTrueIterator ( ) : Traversable
Résultat Traversable

groupBy() public méthode

This will implicitly index each group by the group key returned from the supplied function.
public groupBy ( callable $function ) : pinq\ITraversable
$function callable The grouping function
Résultat pinq\ITraversable

groupJoin() public méthode

Matches the values with the supplied values according to the supplied filter, groups the the joined values for every original and then maps into as according to the supplied function.
public groupJoin ( array | Traversable $values ) : Pinq\Interfaces\IJoiningOnTraversable
$values array | Traversable
Résultat Pinq\Interfaces\IJoiningOnTraversable

indexBy() public méthode

All duplicate indexes will be associated with the first value for that index.
public indexBy ( callable $function ) : pinq\ITraversable
$function callable The projection function
Résultat pinq\ITraversable

intersect() public méthode

(Uses strict equality '===')
public intersect ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to intersect with
Résultat pinq\ITraversable

isSource() public méthode

Returns whether the traversable is the source of the elements.
public isSource ( ) : boolean
Résultat boolean

iterate() public méthode

Returning false will break the iteration loop.
public iterate ( callable $function ) : void
$function callable The iteration function, parameters are passed as ($value, $key)
Résultat void

join() public méthode

Matches the values with the supplied values according to the supplied filter then maps the results into as according to the supplied function.
public join ( array | Traversable $values ) : Pinq\Interfaces\IJoiningOnTraversable
$values array | Traversable
Résultat Pinq\Interfaces\IJoiningOnTraversable

keys() public méthode

Selects the keys as the values (indexed by their 0-based position).
public keys ( ) : pinq\ITraversable
Résultat pinq\ITraversable

last() public méthode

Returns the last value, null if empty
public last ( ) : mixed
Résultat mixed The last value

orderBy() public méthode

Orders the values mapped from the supplied function according the supplied direction.
public orderBy ( callable $function, integer $direction ) : Pinq\Interfaces\IOrderedTraversable
$function callable The projection function
$direction integer
Résultat Pinq\Interfaces\IOrderedTraversable

orderByAscending() public méthode

Orders the values mapped from the supplied function ascendingly Example function:
public orderByAscending ( callable $function ) : Pinq\Interfaces\IOrderedTraversable
$function callable The mapping function
Résultat Pinq\Interfaces\IOrderedTraversable

orderByDescending() public méthode

Orders the values mapped from the supplied function descendingly Example expression function:
public orderByDescending ( callable $function ) : Pinq\Interfaces\IOrderedTraversable
$function callable The mapping function
Résultat Pinq\Interfaces\IOrderedTraversable

reindex() public méthode

Indexes the values by their 0-based position.
public reindex ( ) : pinq\ITraversable
Résultat pinq\ITraversable

select() public méthode

Returns the values mapped by the supplied function.
public select ( callable $function ) : pinq\ITraversable
$function callable The function returning the data to select
Résultat pinq\ITraversable

selectMany() public méthode

Returns the values mapped by the supplied function and then flattens the values into a single traversable. Keys will be reindexed.
public selectMany ( callable $function ) : pinq\ITraversable
$function callable The function returning the data to select
Résultat pinq\ITraversable

skip() public méthode

Skip the amount of values from the start.
public skip ( integer $amount ) : pinq\ITraversable
$amount integer The amount of values to skip, must be > 0
Résultat pinq\ITraversable

slice() public méthode

Retrieve a slice of the values.
public slice ( integer $start, integer | null $amount ) : pinq\ITraversable
$start integer The amount of values to skip
$amount integer | null The amount of values to retrieve
Résultat pinq\ITraversable

take() public méthode

Limits the amount of values by the supplied amount
public take ( integer | null $amount ) : pinq\ITraversable
$amount integer | null The amount of values to retrieve, must be > 0 or null if all
Résultat pinq\ITraversable

union() public méthode

(Uses strict equality '===')
public union ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to union
Résultat pinq\ITraversable

unique() public méthode

Only return unique values. (Uses strict equality '===')
public unique ( ) : pinq\ITraversable
Résultat pinq\ITraversable

where() public méthode

Filters the values by a supplied predicate.
public where ( callable $predicate ) : pinq\ITraversable
$predicate callable The predicate function
Résultat pinq\ITraversable

whereIn() public méthode

(Uses strict equality '===')
public whereIn ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable
Résultat pinq\ITraversable