PHP 클래스 Yosymfony\Spress\Core\Support\ItemCollection

저자: Victor Puertas ([email protected])
상속: implements IteratorAggregate, implements Countable
파일 보기 프로젝트 열기: spress/spress 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( array $items = [] ) Constructor.
add ( Yosymfony\Spress\Core\DataSource\ItemInterface $item ) Adds an new item.
all ( array $collections = [], boolean $groupByCollection = false ) : array Returns all items in this collection.
clear ( ) Clears all items in this collection.
count ( ) : integer Counts the items registered.
get ( string $id ) : Yosymfony\Spress\Core\DataSource\ItemInterface Gets an item.
getIterator ( ) : ArrayIterator Gets the current ItemCollection as an Iterator that includes all items.
has ( string $id ) : boolean Checks if a item exists.
remove ( string $id ) Removes an item.
set ( Yosymfony\Spress\Core\DataSource\ItemInterface $item ) Sets an item.
sortItems ( string $attribute, boolean $descending = true, array $collections = [] ) : Yosymfony\Spress\Core\Support\ItemCollection Sorts items in this collection.

메소드 상세

__construct() 공개 메소드

Yosymfony\Spress\Core\DataSource\ItemInterface[] $items
public __construct ( array $items = [] )
$items array

add() 공개 메소드

Adds an new item.
public add ( Yosymfony\Spress\Core\DataSource\ItemInterface $item )
$item Yosymfony\Spress\Core\DataSource\ItemInterface

all() 공개 메소드

Returns all items in this collection.
public all ( array $collections = [], boolean $groupByCollection = false ) : array
$collections array The name of the item collections affected. Array empty means all
$groupByCollection boolean First level of array is the collection name
리턴 array

clear() 공개 메소드

Clears all items in this collection.
public clear ( )

count() 공개 메소드

Counts the items registered.
public count ( ) : integer
리턴 integer

get() 공개 메소드

Gets an item.
public get ( string $id ) : Yosymfony\Spress\Core\DataSource\ItemInterface
$id string The identifier of the item
리턴 Yosymfony\Spress\Core\DataSource\ItemInterface

getIterator() 공개 메소드

The key of each item is the item's id.
public getIterator ( ) : ArrayIterator
리턴 ArrayIterator An \ArrayIterator object for iterating over items

has() 공개 메소드

Checks if a item exists.
public has ( string $id ) : boolean
$id string The identifier of the item
리턴 boolean

remove() 공개 메소드

Removes an item.
public remove ( string $id )
$id string The identifier of the item

set() 공개 메소드

Sets an item.
public set ( Yosymfony\Spress\Core\DataSource\ItemInterface $item )
$item Yosymfony\Spress\Core\DataSource\ItemInterface

sortItems() 공개 메소드

e.g:. $itemCollection = new ItemCollection(); warm-up... $items = $itemCollection->sortItems('date', true)->all();
public sortItems ( string $attribute, boolean $descending = true, array $collections = [] ) : Yosymfony\Spress\Core\Support\ItemCollection
$attribute string The name of the attribute used to sort
$descending boolean Is descending sort?
$collections array Only the items belong to Collections will be affected
리턴 Yosymfony\Spress\Core\Support\ItemCollection An intance of itself