PHP 클래스 rcrowe\Hippy\Queue

상속: implements rcrowe\Hippy\Message\SenderInterface, implements ArrayAccess, implements Iterator, implements Countable
파일 보기 프로젝트 열기: rcrowe/hippy 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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