PHP Класс rcrowe\Hippy\Queue

Наследование: implements rcrowe\Hippy\Message\SenderInterface, implements ArrayAccess, implements Iterator, implements Countable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$container array The queue it's self. Just a simple array.

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

Метод Описание
add ( rcrowe\Hippy\Message\MessageInterface $message ) : integer Add an item to the queue.
count ( ) : integer Return the number of items currently in the queue.
current ( ) : string Returns the current element.
key ( ) : integer Returns the key of the current element.
next ( ) : void Moves the current position to the next queue.
offsetExists ( integer $offset ) : boolean Using the array interface, check whether an index in the queue exists.
offsetGet ( integer $offset ) : string | null Using the array interface, get an item from the queue.
offsetSet ( integer | null $offset, $value ) : void Set an index of the queue with an array interface.
offsetUnset ( integer $offset ) : boolean Using the array interface, remove an item from the queue.
remove ( integer $index = null ) : boolean Remove an item from the queue.
rewind ( ) : void Rewind back to the first element in the queue.
valid ( ) : boolean This method is called after Iterator::rewind() and Iterator::next() to check if the current position is valid.

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

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

The benefit of using the add function over using the queue as an array is that you are given back an index of the new item in the queue. This index allows you to remove it at a later stage if you choose.
См. также: rcrowe\Hippy\Message\Queue::offsetSet()
public add ( rcrowe\Hippy\Message\MessageInterface $message ) : integer
$message rcrowe\Hippy\Message\MessageInterface
Результат integer Index of the new item in the queue.

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

For example: count($queue)
public count ( ) : integer
Результат integer

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

Returns the current element.
public current ( ) : string
Результат string

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

Returns the key of the current element.
public key ( ) : integer
Результат integer

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

Moves the current position to the next queue.
public next ( ) : void
Результат void

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

For example isset($queue[0]);
public offsetExists ( integer $offset ) : boolean
$offset integer Index that you want to check the existence for.
Результат boolean Whether the index exists or not.

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

For example echo $queue[0];
public offsetGet ( integer $offset ) : string | null
$offset integer Index that you want to get the value for.
Результат string | null If the index can not be found NULL is returned, else the value in the queue.

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

For example $queue[] = 'string' or $queue[1] = 'string'. NOTE: Currently if adding a new item, even when passing an offset, the value will be appended and not interested at that index. If the index exists, then the old value will be removed and then the new value appended.
public offsetSet ( integer | null $offset, $value ) : void
$offset integer | null Index of the queue to remove/add.
Результат void

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

For example unset($queue[1]);
public offsetUnset ( integer $offset ) : boolean
$offset integer Index that you want to remove from the queue.
Результат boolean TRUE when the item is removed.

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

Remove an item from the queue.
См. также: rcrowe\Campfire\Message\Queue::add()
public remove ( integer $index = null ) : boolean
$index integer Index for the message in the queue you want removed. NULL empties queue.
Результат boolean TRUE when the item is removed from the queue

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

Rewind back to the first element in the queue.
public rewind ( ) : void
Результат void

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

This method is called after Iterator::rewind() and Iterator::next() to check if the current position is valid.
public valid ( ) : boolean
Результат boolean

Описание свойств

$container защищенное свойство

The queue it's self. Just a simple array.
protected array $container
Результат array