QueueBase.php

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

Namespace

Drush\Queue

Classes

Namesort descending Description
QueueBase

File

lib/Drush/Queue/QueueBase.php
View source
  1. <?php
  2. namespace Drush\Queue;
  3. abstract class QueueBase implements QueueInterface {
  4. /**
  5. * Keep track of queue definitions.
  6. *
  7. * @var array
  8. */
  9. protected static $queues;
  10. /**
  11. * Lists all available queues.
  12. */
  13. public function listQueues() {
  14. $result = array();
  15. foreach (array_keys($this->getQueues()) as $name) {
  16. $q = $this->getQueue($name);
  17. $result[$name] = array(
  18. 'queue' => $name,
  19. 'items' => $q->numberOfItems(),
  20. 'class' => get_class($q),
  21. );
  22. }
  23. return $result;
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function getInfo($name) {
  29. $queues = $this->getQueues();
  30. if (!isset($queues[$name])) {
  31. throw new QueueException(dt('Could not find the !name queue.', array('!name' => $name)));
  32. }
  33. return $queues[$name];
  34. }
  35. }