PHP Интерфейс Puli\Repository\Api\ResourceCollection

С версии: 1.0
Автор: Bernhard Schussek ([email protected])
Наследование: extends Traversabl\Traversable, extends ArrayAcces\ArrayAccess, extends Countabl\Countable
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
add ( Puli\Repository\Api\Resource\PuliResource $resource ) Adds a resource to the collection.
clear ( ) Removes all resources from the collection.
get ( integer $key ) : Puli\Repository\Api\Resource\PuliResource Returns the resource for a collection key.
getNames ( ) : string[] Returns the names of all resources in the collection.
getPaths ( ) : string[] Returns the paths of all resources in the collection.
has ( integer $key ) : boolean Returns whether a collection key exists.
isEmpty ( ) : boolean Returns whether the collection is empty.
keys ( ) : int[] Returns the keys of the collection.
merge ( Puli\Repository\Api\Resource\PuliResource[] | Traversabl\Traversable $resources ) Merges the given resources into the collection.
remove ( integer $key ) Removes a collection key from the collection.
replace ( Puli\Repository\Api\Resource\PuliResource[] | Traversabl\Traversable $resources ) Replaces the collection contents with the given resources.
set ( integer $key, Puli\Repository\Api\Resource\PuliResource $resource ) Sets a resource at a collection key.
toArray ( ) : Puli\Repository\Api\Resource\PuliResource[] Returns the collection contents as array.

Описание методов

add() публичный Метод

Adds a resource to the collection.
public add ( Puli\Repository\Api\Resource\PuliResource $resource )
$resource Puli\Repository\Api\Resource\PuliResource The added resource.

clear() публичный Метод

Removes all resources from the collection.
public clear ( )

get() публичный Метод

Returns the resource for a collection key.
public get ( integer $key ) : Puli\Repository\Api\Resource\PuliResource
$key integer The collection key.
Результат Puli\Repository\Api\Resource\PuliResource The resource at the key.

getNames() публичный Метод

The names are returned in the order of their resources in the collection.
См. также: PuliResource::getName
public getNames ( ) : string[]
Результат string[] The names of the resources in the collection.

getPaths() публичный Метод

The paths are returned in the order of their resources in the collection.
См. также: PuliResource::getPath
public getPaths ( ) : string[]
Результат string[] The paths of the resources in the collection.

has() публичный Метод

Returns whether a collection key exists.
public has ( integer $key ) : boolean
$key integer The collection key.
Результат boolean Whether the collection key exists.

isEmpty() публичный Метод

Returns whether the collection is empty.
public isEmpty ( ) : boolean
Результат boolean Returns `true` only if the collection contains no resources.

keys() публичный Метод

Returns the keys of the collection.
public keys ( ) : int[]
Результат int[] The collection keys.

merge() публичный Метод

Merges the given resources into the collection.
public merge ( Puli\Repository\Api\Resource\PuliResource[] | Traversabl\Traversable $resources )
$resources Puli\Repository\Api\Resource\PuliResource[] | Traversabl\Traversable The resources to merge into the collection.

remove() публичный Метод

Removes a collection key from the collection.
public remove ( integer $key )
$key integer The collection key.

replace() публичный Метод

Replaces the collection contents with the given resources.
public replace ( Puli\Repository\Api\Resource\PuliResource[] | Traversabl\Traversable $resources )
$resources Puli\Repository\Api\Resource\PuliResource[] | Traversabl\Traversable The resources to write into the collection.

set() публичный Метод

Sets a resource at a collection key.
public set ( integer $key, Puli\Repository\Api\Resource\PuliResource $resource )
$key integer The collection key.
$resource Puli\Repository\Api\Resource\PuliResource The resource to set.

toArray() публичный Метод

Returns the collection contents as array.
public toArray ( ) : Puli\Repository\Api\Resource\PuliResource[]
Результат Puli\Repository\Api\Resource\PuliResource[] The resources in the collection.