MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
Referência à classe ArrayCollection
Diagrama de heranças da classe ArrayCollection
Collection

Membros públicos

 __construct (array $elements=array())
 
 toArray ()
 
 first ()
 
 last ()
 
 key ()
 
 next ()
 
 current ()
 
 remove ($key)
 
 removeElement ($element)
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 containsKey ($key)
 
 contains ($element)
 
 exists (Closure $p)
 
 indexOf ($element)
 
 get ($key)
 
 getKeys ()
 
 getValues ()
 
 count ()
 
 set ($key, $value)
 
 add ($value)
 
 isEmpty ()
 
 getIterator ()
 
 map (Closure $func)
 
 filter (Closure $p)
 
 forAll (Closure $p)
 
 partition (Closure $p)
 
 __toString ()
 
 clear ()
 
 slice ($offset, $length=null)
 

Descrição detalhada

An ArrayCollection is a Collection implementation that wraps a regular PHP array.

Desde
2.0
Autor
Guilherme Blanco guilh.nosp@m.erme.nosp@m.blanc.nosp@m.o@ho.nosp@m.tmail.nosp@m..com
Jonathan Wage jonwa.nosp@m.ge@g.nosp@m.mail..nosp@m.com
Roman Borschel roman.nosp@m.@cod.nosp@m.e-fac.nosp@m.tory.nosp@m..org

Definido na linha 32 do ficheiro ArrayCollection.php.

Documentação dos Construtores & Destrutor

◆ __construct()

__construct ( array $elements = array())

Initializes a new ArrayCollection.

Parâmetros
array$elements

Definido na linha 46 do ficheiro ArrayCollection.php.

Documentação das funções

◆ __toString()

__toString ( )

Returns a string representation of this object.

Retorna
string

Definido na linha 410 do ficheiro ArrayCollection.php.

◆ add()

add ( $value)

Adds an element to the collection.

Parâmetros
mixed$value
Retorna
boolean Always TRUE.

Implementa Collection.

Definido na linha 313 do ficheiro ArrayCollection.php.

◆ clear()

clear ( )

Clears the collection.

Implementa Collection.

Definido na linha 418 do ficheiro ArrayCollection.php.

◆ contains()

contains ( $element)

Checks whether the given element is contained in the collection. Only element values are compared, not keys. The comparison of two elements is strict, that means not only the value but also the type must match. For objects this means reference equality.

Parâmetros
mixed$element
Retorna
boolean TRUE if the given element is contained in the collection, FALSE otherwise.

Implementa Collection.

Definido na linha 215 do ficheiro ArrayCollection.php.

◆ containsKey()

containsKey ( $key)

Checks whether the collection contains a specific key/index.

Parâmetros
mixed$keyThe key to check for.
Retorna
boolean TRUE if the given key/index exists, FALSE otherwise.

Implementa Collection.

Definido na linha 200 do ficheiro ArrayCollection.php.

◆ count()

count ( )

Returns the number of elements in the collection.

Implementation of the Countable interface.

Retorna
integer The number of elements in the collection.

Definido na linha 288 do ficheiro ArrayCollection.php.

◆ current()

current ( )

Gets the element of the collection at the current internal iterator position.

Retorna
mixed

Implementa Collection.

Definido na linha 108 do ficheiro ArrayCollection.php.

◆ exists()

exists ( Closure $p)

Tests for the existance of an element that satisfies the given predicate.

Parâmetros
Closure$pThe predicate.
Retorna
boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise.

Implementa Collection.

Definido na linha 226 do ficheiro ArrayCollection.php.

◆ filter()

filter ( Closure $p)

Returns all the elements of this collection that satisfy the predicate p. The order of the elements is preserved.

Parâmetros
Closure$pThe predicate used for filtering.
Retorna
Collection A collection with the results of the filter operation.

Implementa Collection.

Definido na linha 360 do ficheiro ArrayCollection.php.

◆ first()

first ( )

Sets the internal iterator to the first element in the collection and returns this element.

Retorna
mixed

Implementa Collection.

Definido na linha 67 do ficheiro ArrayCollection.php.

◆ forAll()

forAll ( Closure $p)

Applies the given predicate p to all elements of this collection, returning true, if the predicate yields true for all elements.

Parâmetros
Closure$pThe predicate.
Retorna
boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.

Implementa Collection.

Definido na linha 372 do ficheiro ArrayCollection.php.

◆ get()

get ( $key)

Gets the element with the given key/index.

Parâmetros
mixed$keyThe key.
Retorna
mixed The element or NULL, if no element exists for the given key.

Implementa Collection.

Definido na linha 253 do ficheiro ArrayCollection.php.

◆ getIterator()

getIterator ( )

Gets an iterator for iterating over the elements in the collection.

Retorna
ArrayIterator

Definido na linha 336 do ficheiro ArrayCollection.php.

◆ getKeys()

getKeys ( )

Gets all keys/indexes of the collection elements.

Retorna
array

Implementa Collection.

Definido na linha 266 do ficheiro ArrayCollection.php.

◆ getValues()

getValues ( )

Gets all elements.

Retorna
array

Implementa Collection.

Definido na linha 276 do ficheiro ArrayCollection.php.

◆ indexOf()

indexOf ( $element)

Searches for a given element and, if found, returns the corresponding key/index of that element. The comparison of two elements is strict, that means not only the value but also the type must match. For objects this means reference equality.

Parâmetros
mixed$elementThe element to search for.
Retorna
mixed The key/index of the element or FALSE if the element was not found.

Implementa Collection.

Definido na linha 242 do ficheiro ArrayCollection.php.

◆ isEmpty()

isEmpty ( )

Checks whether the collection is empty.

Note: This is preferrable over count() == 0.

Retorna
boolean TRUE if the collection is empty, FALSE otherwise.

Implementa Collection.

Definido na linha 326 do ficheiro ArrayCollection.php.

◆ key()

key ( )

Gets the current key/index at the current internal iterator position.

Retorna
mixed

Implementa Collection.

Definido na linha 88 do ficheiro ArrayCollection.php.

◆ last()

last ( )

Sets the internal iterator to the last element in the collection and returns this element.

Retorna
mixed

Implementa Collection.

Definido na linha 78 do ficheiro ArrayCollection.php.

◆ map()

map ( Closure $func)

Applies the given function to each element in the collection and returns a new collection with the elements returned by the function.

Parâmetros
Closure$func
Retorna
Collection

Implementa Collection.

Definido na linha 348 do ficheiro ArrayCollection.php.

◆ next()

next ( )

Moves the internal iterator position to the next element.

Retorna
mixed

Implementa Collection.

Definido na linha 98 do ficheiro ArrayCollection.php.

◆ offsetExists()

offsetExists ( $offset)

ArrayAccess implementation of offsetExists()

Veja também
containsKey()

Definido na linha 155 do ficheiro ArrayCollection.php.

◆ offsetGet()

offsetGet ( $offset)

ArrayAccess implementation of offsetGet()

Veja também
get()

Definido na linha 165 do ficheiro ArrayCollection.php.

◆ offsetSet()

offsetSet ( $offset,
$value )

ArrayAccess implementation of offsetGet()

Veja também
add()
set()

Definido na linha 176 do ficheiro ArrayCollection.php.

◆ offsetUnset()

offsetUnset ( $offset)

ArrayAccess implementation of offsetUnset()

Veja também
remove()

Definido na linha 189 do ficheiro ArrayCollection.php.

◆ partition()

partition ( Closure $p)

Partitions this collection in two collections according to a predicate. Keys are preserved in the resulting collections.

Parâmetros
Closure$pThe predicate on which to partition.
Retorna
array An array with two elements. The first element contains the collection of elements where the predicate returned TRUE, the second element contains the collection of elements where the predicate returned FALSE.

Implementa Collection.

Definido na linha 392 do ficheiro ArrayCollection.php.

◆ remove()

remove ( $key)

Removes an element with a specific key/index from the collection.

Parâmetros
mixed$key
Retorna
mixed The removed element or NULL, if no element exists for the given key.

Implementa Collection.

Definido na linha 119 do ficheiro ArrayCollection.php.

◆ removeElement()

removeElement ( $element)

Removes the specified element from the collection, if it is found.

Parâmetros
mixed$elementThe element to remove.
Retorna
boolean TRUE if this collection contained the specified element, FALSE otherwise.

Implementa Collection.

Definido na linha 137 do ficheiro ArrayCollection.php.

◆ set()

set ( $key,
$value )

Adds/sets an element in the collection at the index / with the specified key.

When the collection is a Map this is like put(key,value)/add(key,value). When the collection is a List this is like add(position,value).

Parâmetros
mixed$key
mixed$value

Implementa Collection.

Definido na linha 302 do ficheiro ArrayCollection.php.

◆ slice()

slice ( $offset,
$length = null )

Extract a slice of $length elements starting at position $offset from the Collection.

If $length is null it returns all elements from $offset to the end of the Collection. Keys have to be preserved by this method. Calling this method will only return the selected slice and NOT change the elements contained in the collection slice is called on.

Parâmetros
int$offset
int$length
Retorna
array

Implementa Collection.

Definido na linha 434 do ficheiro ArrayCollection.php.

◆ toArray()

toArray ( )

Gets the PHP array representation of this collection.

Retorna
array The PHP array representation of this collection.

Implementa Collection.

Definido na linha 56 do ficheiro ArrayCollection.php.


A documentação para esta classe foi gerada a partir do seguinte ficheiro: