for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Purple - Run tasks on collections
*
* PHP version 5
* Copyright (C) 2016 Jake Johns
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* @category Queue
* @package Jnjxp\Purple
* @author Jake Johns <[email protected]>
* @copyright 2016 Jake Johns
* @license http://jnj.mit-license.org/2016 MIT License
* @link https://github.com/jnjxp/jnjxp.purple
*/
namespace Jnjxp\Purple;
use IteratorAggregate;
* Queue
* @license http://jnj.mit-license.org/ MIT License
class Queue implements IteratorAggregate, QueueInterface
{
* @var SplPriorityQueue
* @access protected
protected $queue;
* __construct
* @access public
public function __construct()
$this->queue = new SplPriorityQueue;
}
* Count
* @return int
public function count()
return count($this->queue);
* Insert
* @param mixed $value value
* @param mixed $priority order priority
* @return void
public function insert($value, $priority)
$this->queue->insert($value, $priority);
* Get Iterator
* @return SplPriorityQueue
public function getIterator()
return clone $this->queue;
* Clear
public function clear()
while (!$this->queue->isEmpty()) {
$this->queue->next();