PHP Интерфейс Pinq\ITraversable

Query calls must be immutable and return a new instance with every query call. Queries should also be executed lazily upon iteration.
Автор: Elliot Levin ([email protected])
Наследование: extends pinq\IAggregatable, extends IteratorAggregate, extends ArrayAccess
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
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.

Описание методов

append() публичный Метод

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
Результат pinq\ITraversable

asArray() публичный Метод

Only valid array keys (strings or integers) will be used, all others will be reindexed numerically.
public asArray ( ) : array
Результат array

asCollection() публичный Метод

The following queries will be performed in memory.
public asCollection ( ) : pinq\ICollection
Результат pinq\ICollection

asTraversable() публичный Метод

The following queries will be performed in memory.
public asTraversable ( ) : pinq\ITraversable
Результат pinq\ITraversable

contains() публичный Метод

Returns whether the supplied value is contained within the aggregate
public contains ( mixed $value ) : boolean
$value mixed The value to check for
Результат boolean

difference() публичный Метод

(Uses strict equality '===')
public difference ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to remove
Результат pinq\ITraversable

except() публичный Метод

(Uses strict equality '===')
public except ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to union
Результат pinq\ITraversable

first() публичный Метод

Returns the first value, null if empty
public first ( ) : mixed
Результат mixed The first value

getIterator() публичный Метод

Non string or integer keys will be numerically reindexed.
public getIterator ( ) : Traversable
Результат Traversable

getIteratorScheme() публичный Метод

Returns the underlying iterator scheme used by the implementation.
public getIteratorScheme ( ) : Pinq\Iterators\IIteratorScheme
Результат Pinq\Iterators\IIteratorScheme

getSource() публичный Метод

Returns the source traversable or itself if the current traversable is the source.
public getSource ( ) : pinq\ITraversable
Результат pinq\ITraversable

getTrueIterator() публичный Метод

All keys types will remain unaltered.
public getTrueIterator ( ) : Traversable
Результат Traversable

groupBy() публичный Метод

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
Результат pinq\ITraversable

groupJoin() публичный Метод

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
Результат Pinq\Interfaces\IJoiningOnTraversable

indexBy() публичный Метод

All duplicate indexes will be associated with the first value for that index.
public indexBy ( callable $function ) : pinq\ITraversable
$function callable The projection function
Результат pinq\ITraversable

intersect() публичный Метод

(Uses strict equality '===')
public intersect ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to intersect with
Результат pinq\ITraversable

isSource() публичный Метод

Returns whether the traversable is the source of the elements.
public isSource ( ) : boolean
Результат boolean

iterate() публичный Метод

Returning false will break the iteration loop.
public iterate ( callable $function ) : void
$function callable The iteration function, parameters are passed as ($value, $key)
Результат void

join() публичный Метод

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
Результат Pinq\Interfaces\IJoiningOnTraversable

keys() публичный Метод

Selects the keys as the values (indexed by their 0-based position).
public keys ( ) : pinq\ITraversable
Результат pinq\ITraversable

last() публичный Метод

Returns the last value, null if empty
public last ( ) : mixed
Результат mixed The last value

orderBy() публичный Метод

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
Результат Pinq\Interfaces\IOrderedTraversable

orderByAscending() публичный Метод

Orders the values mapped from the supplied function ascendingly Example function:
public orderByAscending ( callable $function ) : Pinq\Interfaces\IOrderedTraversable
$function callable The mapping function
Результат Pinq\Interfaces\IOrderedTraversable

orderByDescending() публичный Метод

Orders the values mapped from the supplied function descendingly Example expression function:
public orderByDescending ( callable $function ) : Pinq\Interfaces\IOrderedTraversable
$function callable The mapping function
Результат Pinq\Interfaces\IOrderedTraversable

reindex() публичный Метод

Indexes the values by their 0-based position.
public reindex ( ) : pinq\ITraversable
Результат pinq\ITraversable

select() публичный Метод

Returns the values mapped by the supplied function.
public select ( callable $function ) : pinq\ITraversable
$function callable The function returning the data to select
Результат pinq\ITraversable

selectMany() публичный Метод

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
Результат pinq\ITraversable

skip() публичный Метод

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
Результат pinq\ITraversable

slice() публичный Метод

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
Результат pinq\ITraversable

take() публичный Метод

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
Результат pinq\ITraversable

union() публичный Метод

(Uses strict equality '===')
public union ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable The values to union
Результат pinq\ITraversable

unique() публичный Метод

Only return unique values. (Uses strict equality '===')
public unique ( ) : pinq\ITraversable
Результат pinq\ITraversable

where() публичный Метод

Filters the values by a supplied predicate.
public where ( callable $predicate ) : pinq\ITraversable
$predicate callable The predicate function
Результат pinq\ITraversable

whereIn() публичный Метод

(Uses strict equality '===')
public whereIn ( array | Traversable $values ) : pinq\ITraversable
$values array | Traversable
Результат pinq\ITraversable