Elgg  Version 1.9
MemoryQueue.php
Go to the documentation of this file.
1 <?php
2 
15 
16  /* @var array */
17  protected $queue = array();
18 
22  public function __construct() {
23  $this->queue = array();
24  }
25 
29  public function enqueue($item) {
30  return (bool)array_push($this->queue, $item);
31  }
32 
36  public function dequeue() {
37  return array_shift($this->queue);
38  }
39 
43  public function clear() {
44  $this->queue = array();
45  }
46 
50  public function size() {
51  return count($this->queue);
52  }
53 }
enqueue($item)
{Add an item to the queue.Item to add to queue bool}
Definition: MemoryQueue.php:29
clear()
{Clear all items from the queue.void}
Definition: MemoryQueue.php:43
dequeue()
{Remove an item from the queue.mixed}
Definition: MemoryQueue.php:36
$item
Definition: item.php:12
__construct()
Create a queue.
Definition: MemoryQueue.php:22
size()
{Get the size of the queue.int}
Definition: MemoryQueue.php:50