Prado\Collections\TQueue::dequeue PHP Метод

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

Removes and returns the object at the beginning of the queue.
public dequeue ( ) : mixed
Результат mixed the item at the beginning of the queue
    public function dequeue()
    {
        if ($this->_c === 0) {
            throw new TInvalidOperationException('queue_empty');
        } else {
            --$this->_c;
            return array_shift($this->_d);
        }
    }

Usage Example

Пример #1
0
 public function testCanNotDequeueAnEmptyQueue()
 {
     $queue = new TQueue();
     try {
         $item = $queue->dequeue();
     } catch (TInvalidOperationException $e) {
         return;
     }
     self::fail('An expected TInvalidOperationException was not raised');
 }