You are here

public function PriorityQueue::insert in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-stdlib/src/PriorityQueue.php \Zend\Stdlib\PriorityQueue::insert()

Insert an item into the queue

Priority defaults to 1 (low priority) if none provided.

Parameters

mixed $data:

int $priority:

Return value

PriorityQueue

1 call to PriorityQueue::insert()
PriorityQueue::unserialize in vendor/zendframework/zend-stdlib/src/PriorityQueue.php
Unserialize a string into a PriorityQueue object

File

vendor/zendframework/zend-stdlib/src/PriorityQueue.php, line 62

Class

PriorityQueue
Re-usable, serializable priority queue implementation

Namespace

Zend\Stdlib

Code

public function insert($data, $priority = 1) {
  $priority = (int) $priority;
  $this->items[] = [
    'data' => $data,
    'priority' => $priority,
  ];
  $this
    ->getQueue()
    ->insert($data, $priority);
  return $this;
}