PHP 클래스 Qaribou\Collection\ImmArray

상속: implements Iterato\Iterator, implements ArrayAcces\ArrayAccess, implements Countabl\Countable, implements JsonSerializabl\JsonSerializable
파일 보기 프로젝트 열기: jkoudys/immutable.php 1 사용 예제들

공개 메소드들

메소드 설명
concat ( ) : ImmArray Concat to the end of this array
count ( ) Countable
current ( ) Iterator
filter ( callable $cb ) : ImmArray Filter out elements
fromArray ( array $arr ) : ImmArray Build from an array
fromItems ( Traversable $arr ) : ImmArray Factory for building ImmArrays from any traversable
join ( string $token = ',', string $secondToken = null ) : string Join a set of strings together.
jsonSerialize ( ) JsonSerializable
key ( )
map ( callable $cb ) : ImmArray Map elements to a new ImmArray via a callback
next ( )
offsetExists ( $offset ) ArrayAccess
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
reduce ( callable $cb, mixed $initial = null ) Reduce to a single value
rewind ( )
slice ( integer $begin, integer $end = null ) : ImmArray Take a slice of the array
sort ( callable $cb = null ) : ImmArray Return a new sorted ImmArray
sortHeap ( SplHeap $heap ) : ImmArray Sort a new ImmArray by filtering through a heap.
toArray ( )
valid ( )
walk ( callable $cb ) : ImmArray forEach, or "walk" the data Exists primarily to provide a consistent interface, though it's seldom any better than a simple php foreach. Mainly useful for chaining.

보호된 메소드들

메소드 설명
arraySort ( callable $cb = null ) : ImmArray Fallback behaviour to use the builtin array sort functions
heapSort ( callable $cb ) : ImmArray Sort by applying a CallbackHeap and building a new heap Can be efficient for sorting large stored objects.
mergeSort ( callable $cb ) : ImmArray Perform a bottom-up, non-recursive, in-place mergesort.
quickSort ( callable $cb ) : ImmArray A classic quickSort - great for inplace sorting a big fixed array

비공개 메소드들

메소드 설명
__construct ( Traversable $immute ) Create an immutable array

메소드 상세

arraySort() 보호된 메소드

Fallback behaviour to use the builtin array sort functions
protected arraySort ( callable $cb = null ) : ImmArray
$cb callable The callback for comparison
리턴 ImmArray

concat() 공개 메소드

Concat to the end of this array
public concat ( ) : ImmArray
리턴 ImmArray

count() 공개 메소드

Countable
public count ( )

current() 공개 메소드

Iterator
public current ( )

filter() 공개 메소드

Filter out elements
public filter ( callable $cb ) : ImmArray
$cb callable Function to filter out on false
리턴 ImmArray

fromArray() 공개 정적인 메소드

Build from an array
public static fromArray ( array $arr ) : ImmArray
$arr array
리턴 ImmArray

fromItems() 공개 정적인 메소드

Factory for building ImmArrays from any traversable
public static fromItems ( Traversable $arr ) : ImmArray
$arr Traversable
리턴 ImmArray

heapSort() 보호된 메소드

Sort by applying a CallbackHeap and building a new heap Can be efficient for sorting large stored objects.
protected heapSort ( callable $cb ) : ImmArray
$cb callable The comparison callback
리턴 ImmArray

join() 공개 메소드

Join a set of strings together.
public join ( string $token = ',', string $secondToken = null ) : string
$token string Main token to put between elements
$secondToken string If set, $token on left $secondToken on right
리턴 string

jsonSerialize() 공개 메소드

JsonSerializable
public jsonSerialize ( )

key() 공개 메소드

public key ( )

map() 공개 메소드

Map elements to a new ImmArray via a callback
public map ( callable $cb ) : ImmArray
$cb callable Function to map new data
리턴 ImmArray

mergeSort() 보호된 메소드

Efficient for very-large objects, and written without recursion since PHP isn't well optimized for large recursion stacks.
protected mergeSort ( callable $cb ) : ImmArray
$cb callable The callback for comparison
리턴 ImmArray

next() 공개 메소드

public next ( )

offsetExists() 공개 메소드

ArrayAccess
public offsetExists ( $offset )

offsetGet() 공개 메소드

public offsetGet ( $offset )

offsetSet() 공개 메소드

public offsetSet ( $offset, $value )

offsetUnset() 공개 메소드

public offsetUnset ( $offset )

quickSort() 보호된 메소드

A classic quickSort - great for inplace sorting a big fixed array
protected quickSort ( callable $cb ) : ImmArray
$cb callable The callback for comparison
리턴 ImmArray

reduce() 공개 메소드

Reduce to a single value
public reduce ( callable $cb, mixed $initial = null )
$cb callable Callback( mixed $previous, mixed $current[, mixed $index, mixed $immArray] ):mixed Callback to run reducing function
$initial mixed Initial value for first argument

rewind() 공개 메소드

public rewind ( )

slice() 공개 메소드

Take a slice of the array
public slice ( integer $begin, integer $end = null ) : ImmArray
$begin integer Start index of slice
$end integer End index of slice
리턴 ImmArray

sort() 공개 메소드

Return a new sorted ImmArray
public sort ( callable $cb = null ) : ImmArray
$cb callable The sort callback
리턴 ImmArray

sortHeap() 공개 메소드

Tends to run much faster than array or merge sorts, since you're only sorting the pointers, and the sort function is running in a highly optimized space.
public sortHeap ( SplHeap $heap ) : ImmArray
$heap SplHeap The heap to run for sorting
리턴 ImmArray

toArray() 공개 메소드

public toArray ( )

valid() 공개 메소드

public valid ( )

walk() 공개 메소드

Named walk for historic reasons - forEach is reserved in PHP
public walk ( callable $cb ) : ImmArray
$cb callable Function to call on each element
리턴 ImmArray