HistoryBatch.php 758 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Guzzle\Batch;
  3. /**
  4. * BatchInterface decorator used to keep a history of items that were added to the batch. You must clear the history
  5. * manually to remove items from the history.
  6. */
  7. class HistoryBatch extends AbstractBatchDecorator
  8. {
  9. /** @var array Items in the history */
  10. protected $history = array();
  11. public function add($item)
  12. {
  13. $this->history[] = $item;
  14. $this->decoratedBatch->add($item);
  15. return $this;
  16. }
  17. /**
  18. * Get the batch history
  19. *
  20. * @return array
  21. */
  22. public function getHistory()
  23. {
  24. return $this->history;
  25. }
  26. /**
  27. * Clear the batch history
  28. */
  29. public function clearHistory()
  30. {
  31. $this->history = array();
  32. }
  33. }