abstract class QueueBase

  1. 8.0.x lib/Drush/Queue/QueueBase.php QueueBase
  2. 7.x lib/Drush/Queue/QueueBase.php QueueBase
  3. master lib/Drush/Queue/QueueBase.php QueueBase

Namespace

Drush\Queue

Hierarchy

Expanded class hierarchy of QueueBase

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
QueueBase::$queues protected static property Keep track of queue definitions.
QueueBase::getInfo public function Returns a given queue definition. Overrides QueueInterface::getInfo
QueueBase::listQueues public function Lists all available queues.
QueueInterface::getQueue public function Returns a given queue definition.
QueueInterface::getQueues public function Returns all queues.
QueueInterface::run public function Runs a given queue.

File

lib/Drush/Queue/QueueBase.php, line 5

View source
abstract class QueueBase implements QueueInterface {

  /**
   * Keep track of queue definitions.
   *
   * @var array
   */
  protected static $queues;

  /**
   * Lists all available queues.
   */
  public function listQueues() {
    $result = array();
    foreach (array_keys($this->getQueues()) as $name) {
      $q = $this->getQueue($name);
      $result[$name] = array(
        'queue' => $name,
        'items' => $q->numberOfItems(),
        'class' => get_class($q),
      );
    }
    return $result;
  }

  /**
   * {@inheritdoc}
   */
  public function getInfo($name) {
    $queues = $this->getQueues();
    if (!isset($queues[$name])) {
      throw new QueueException(dt('Could not find the !name queue.', array('!name' => $name)));
    }
    return $queues[$name];
  }

}