PHP Class Yosymfony\Spress\Core\Support\Collection

Author: Victor Puertas ([email protected])
Inheritance: implements IteratorAggregate, implements Countable
Exibir arquivo Open project: spress/spress Class Usage Examples

Protected Properties

Property Type Description
$elements

Public Methods

Method Description
__construct ( array $elements = [] ) Constructor.
add ( mixed $key, mixed $element ) Adds a new element in this collection.
all ( ) : array Gets the elements in this collection.
clear ( ) Clears all elements in this collection.
count ( ) : integer Gets the number of elements in this collection.
get ( string $key ) : mixed Gets a element from the collection.
getIterator ( ) : ArrayIterator Returns an iterator over the elements.
has ( string $key ) : boolean Checks if a elements exists in the collection.
keys ( ) : array Gets the keys registered in this collection.
remove ( string $key ) Removes a element from the collection.
set ( mixed $key, mixed $element ) Sets an element.

Method Details

__construct() public method

Constructor.
public __construct ( array $elements = [] )
$elements array Elements

add() public method

Adds a new element in this collection.
public add ( mixed $key, mixed $element )
$key mixed The key associated to the element
$element mixed The element

all() public method

Gets the elements in this collection.
public all ( ) : array
return array All elements in this collection

clear() public method

Clears all elements in this collection.
public clear ( )

count() public method

Gets the number of elements in this collection.
public count ( ) : integer
return integer The number of elements

get() public method

Gets a element from the collection.
public get ( string $key ) : mixed
$key string The element identifier
return mixed The element

getIterator() public method

Returns an iterator over the elements.
public getIterator ( ) : ArrayIterator
return ArrayIterator An \ArrayIterator object for iterating over elements

has() public method

Checks if a elements exists in the collection.
public has ( string $key ) : boolean
$key string The elements identifier or index
return boolean

keys() public method

Gets the keys registered in this collection.
public keys ( ) : array
return array

remove() public method

Removes a element from the collection.
public remove ( string $key )
$key string The element identifier or index

set() public method

Sets an element.
public set ( mixed $key, mixed $element )
$key mixed The key associated to the element
$element mixed The element

Property Details

$elements protected_oe property

protected $elements