\Colibri\CollectionsObjectCollection

Коллекция обьектов без возможности записи

Summary

Methods
Properties
Constants
Clean()
Add()
Delete()
__construct()
Exists()
Contains()
IndexOf()
Key()
Item()
ItemAt()
getIterator()
Append()
Insert()
DeleteAt()
Clear()
ToString()
FromString()
ToArray()
Count()
First()
Last()
__get()
__set()
offsetSet()
offsetExists()
offsetUnset()
offsetGet()
No public properties found
No constants found
No protected methods found
$data
N/A
No private methods found
$itemClass
N/A

Properties

$data

$data : mixed

Данные коллекции

Type

mixed

$itemClass

$itemClass : string

Возвращаемый класс

Type

string

Methods

Clean()

Clean() : void

Очистить

Add()

Add(string  $key, mixed  $value) : mixed

Добавляет ключ значение в коллекцию, если ключ существует будет произведена замена

Parameters

string $key
mixed $value

Returns

mixed

Delete()

Delete(string  $key) : boolean

Удаляет значение по ключу

Parameters

string $key

Returns

boolean

__construct()

__construct(array  $data = array(), string  $itemClass = '') 

Конструктор

Parameters

array $data
string $itemClass

возвращаемый класс

Exists()

Exists(string  $key) : boolean

Проверяет наличие ключа

Parameters

string $key
  • ключ для проверки

Returns

boolean

Contains()

Contains(mixed  $item) 

Проверяет содержит ли коллекция значение

Parameters

mixed $item
  • значение для проверки

IndexOf()

IndexOf(mixed  $item) 

Находит значение и возвращает индекс

Parameters

mixed $item
  • значение для поиска

Key()

Key(mixed  $index) : string

Возвращает ключ по индексу

Parameters

mixed $index

Returns

string

Item()

Item(string  $key) : mixed

Вернуть обьект по ключу

Parameters

string $key

Returns

mixed

ItemAt()

ItemAt(integer  $index) : mixed

Вернуть обьект по индексу

Parameters

integer $index

Returns

mixed

getIterator()

getIterator() 

Возвращает итератор

Append()

Append(mixed  $from) 

Добавляет значения из другой коллекции, массива или обьекта Для удаления необходимо передать свойство со значением null

Parameters

mixed $from
  • коллекция | массив

Insert()

Insert(mixed  $index, mixed  $key, mixed  $value) 

Добавляет значение в указанное место в коллекцию

Parameters

mixed $index
mixed $key
mixed $value

DeleteAt()

DeleteAt(integer  $index) : boolean

Удаляет значение по индексу

Parameters

integer $index

Returns

boolean

Clear()

Clear() : void

Очищает коллекцию

ToString()

ToString(array<mixed,string>  $splitters = null, mixed  $mapFunction = false) : string

Превращает в строку

Parameters

array<mixed,string> $splitters
mixed $mapFunction

Returns

string

FromString()

FromString(string  $string, array<mixed,string>  $splitters = null) : \Colibri\Collections\Collection

Парсит строку и сохраняет в коллекцию

Parameters

string $string
array<mixed,string> $splitters

Returns

\Colibri\Collections\Collection

ToArray()

ToArray() : array

Возвращает данные в виде массива

Returns

array

Count()

Count() : void

Количество значений в коллекции

First()

First() : mixed

Возвращает первое значение

Returns

mixed

Last()

Last() : mixed

Возвращает последнее значение

Returns

mixed

__get()

__get(string  $property) : mixed

Магическая функция

Parameters

string $property

Returns

mixed

__set()

__set(string  $key, mixed  $value) : void

Магическая функция

Parameters

string $key
mixed $value

offsetSet()

offsetSet(string  $offset, mixed  $value) : void

Устанавливает значение по индексу

Parameters

string $offset
mixed $value

offsetExists()

offsetExists(mixed  $offset) : boolean

Проверяет наличие значения по индексу

Parameters

mixed $offset

Returns

boolean

offsetUnset()

offsetUnset(mixed  $offset) : void

Удаляет значение по индексу

Parameters

mixed $offset

offsetGet()

offsetGet(mixed  $offset) : mixed

Возвращает значение по индексу

Parameters

mixed $offset

Returns

mixed