public function FastPriorityQueue::insert in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-stdlib/src/FastPriorityQueue.php \Zend\Stdlib\FastPriorityQueue::insert()
Insert an element in the queue with a specified priority
Parameters
mixed $value:
integer $priority a positive integer:
1 call to FastPriorityQueue::insert()
- FastPriorityQueue::unserialize in vendor/
zendframework/ zend-stdlib/ src/ FastPriorityQueue.php - Deserialize
File
- vendor/
zendframework/ zend-stdlib/ src/ FastPriorityQueue.php, line 91
Class
- FastPriorityQueue
- This is an efficient implementation of an integer priority queue in PHP
Namespace
Zend\StdlibCode
public function insert($value, $priority) {
if (!is_int($priority)) {
throw new Exception\InvalidArgumentException('The priority must be an integer');
}
$this->values[$priority][] = $value;
if (!isset($this->priorities[$priority])) {
$this->priorities[$priority] = $priority;
$this->maxPriority = max($priority, $this->maxPriority);
}
++$this->count;
}