UpdatedBatchJobCounts.php 856 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Illuminate\Bus;
  3. class UpdatedBatchJobCounts
  4. {
  5. /**
  6. * The number of pending jobs remaining for the batch.
  7. *
  8. * @var int
  9. */
  10. public $pendingJobs;
  11. /**
  12. * The number of failed jobs that belong to the batch.
  13. *
  14. * @var int
  15. */
  16. public $failedJobs;
  17. /**
  18. * Create a new batch job counts object.
  19. *
  20. * @param int $pendingJobs
  21. * @param int $failedJobs
  22. * @return void
  23. */
  24. public function __construct(int $pendingJobs = 0, int $failedJobs = 0)
  25. {
  26. $this->pendingJobs = $pendingJobs;
  27. $this->failedJobs = $failedJobs;
  28. }
  29. /**
  30. * Determine if all jobs have run exactly once.
  31. *
  32. * @return bool
  33. */
  34. public function allJobsHaveRanExactlyOnce()
  35. {
  36. return ($this->pendingJobs - $this->failedJobs) === 0;
  37. }
  38. }