public function PriorityQueue::toArray in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/zendframework/zend-stdlib/src/PriorityQueue.php \Zend\Stdlib\PriorityQueue::toArray()
Serialize to an array
By default, returns only the item data, and in the order registered (not sorted). You may provide one of the EXTR_* flags as an argument, allowing the ability to return priorities or both data and priority.
Parameters
int $flag:
Return value
array
File
- vendor/
zendframework/ zend-stdlib/ src/ PriorityQueue.php, line 206
Class
- PriorityQueue
- Re-usable, serializable priority queue implementation
Namespace
Zend\StdlibCode
public function toArray($flag = self::EXTR_DATA) {
switch ($flag) {
case self::EXTR_BOTH:
return $this->items;
case self::EXTR_PRIORITY:
return array_map(function ($item) {
return $item['priority'];
}, $this->items);
case self::EXTR_DATA:
default:
return array_map(function ($item) {
return $item['data'];
}, $this->items);
}
}