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