PHP Class Collections\Collection

Inheritance: implements collections\CollectionInterface, use trait TypeValidator
Afficher le fichier Open project: danielgsims/php-collections Class Usage Examples

Protected Properties

Свойство Type Description
$items array The collection's encapsulated array

Méthodes publiques

Méthode Description
__construct ( $type, array $items = [] ) Instantiates the collection by specifying what type of Object will be used.
add ( $item )
at ( $index )
clear ( )
contains ( callable $condition )
count ( )
drop ( $num )
dropRight ( $num )
dropWhile ( callable $condition )
each ( callable $callable )
every ( callable $condition )
filter ( callable $condition )
find ( callable $condition )
findIndex ( callable $condition )
findLast ( callable $condition )
findLastIndex ( callable $condition )
getIterator ( )
getType ( )
indexExists ( $index )
insert ( $index, $item )
insertRange ( $index, array $items )
map ( callable $callable )
merge ( $items )
reduce ( callable $callable, $initial = null )
reduceRight ( callable $callable, $initial = null )
removeAt ( $index )
reverse ( )
shuffle ( )
slice ( $start, $end )
sort ( callable $callback )
tail ( )
take ( $num )
takeRight ( $num )
takeWhile ( callable $condition )
toArray ( )
without ( callable $condition )

Méthodes protégées

Méthode Description
countWhileTrue ( callable $condition ) : integer
setItemsFromTrustedSource ( array $items )

Private Methods

Méthode Description
validateIndex ( integer $index ) Validates a number to be used as an index

Method Details

__construct() public méthode

Instantiates the collection by specifying what type of Object will be used.
public __construct ( $type, array $items = [] )
$type
$items array

add() public méthode

public add ( $item )

at() public méthode

public at ( $index )

clear() public méthode

public clear ( )

contains() public méthode

public contains ( callable $condition )
$condition callable

count() public méthode

public count ( )

countWhileTrue() protected méthode

protected countWhileTrue ( callable $condition ) : integer
$condition callable
Résultat integer

drop() public méthode

public drop ( $num )

dropRight() public méthode

public dropRight ( $num )

dropWhile() public méthode

public dropWhile ( callable $condition )
$condition callable

each() public méthode

public each ( callable $callable )
$callable callable

every() public méthode

public every ( callable $condition )
$condition callable

filter() public méthode

public filter ( callable $condition )
$condition callable

find() public méthode

public find ( callable $condition )
$condition callable

findIndex() public méthode

public findIndex ( callable $condition )
$condition callable

findLast() public méthode

public findLast ( callable $condition )
$condition callable

findLastIndex() public méthode

public findLastIndex ( callable $condition )
$condition callable

getIterator() public méthode

public getIterator ( )

getType() public méthode

public getType ( )

indexExists() public méthode

public indexExists ( $index )

insert() public méthode

public insert ( $index, $item )

insertRange() public méthode

public insertRange ( $index, array $items )
$items array

map() public méthode

public map ( callable $callable )
$callable callable

merge() public méthode

public merge ( $items )

reduce() public méthode

public reduce ( callable $callable, $initial = null )
$callable callable

reduceRight() public méthode

public reduceRight ( callable $callable, $initial = null )
$callable callable

removeAt() public méthode

public removeAt ( $index )

reverse() public méthode

public reverse ( )

setItemsFromTrustedSource() protected méthode

protected setItemsFromTrustedSource ( array $items )
$items array

shuffle() public méthode

public shuffle ( )

slice() public méthode

public slice ( $start, $end )

sort() public méthode

public sort ( callable $callback )
$callback callable

tail() public méthode

public tail ( )

take() public méthode

public take ( $num )

takeRight() public méthode

public takeRight ( $num )

takeWhile() public méthode

public takeWhile ( callable $condition )
$condition callable

toArray() public méthode

public toArray ( )

without() public méthode

public without ( callable $condition )
$condition callable

Property Details

$items protected_oe property

The collection's encapsulated array
protected array $items
Résultat array