BatchFactory.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace Illuminate\Bus;
  3. use Carbon\CarbonImmutable;
  4. use Illuminate\Contracts\Queue\Factory as QueueFactory;
  5. class BatchFactory
  6. {
  7. /**
  8. * The queue factory implementation.
  9. *
  10. * @var \Illuminate\Contracts\Queue\Factory
  11. */
  12. protected $queue;
  13. /**
  14. * Create a new batch factory instance.
  15. *
  16. * @param \Illuminate\Contracts\Queue\Factory $queue
  17. * @return void
  18. */
  19. public function __construct(QueueFactory $queue)
  20. {
  21. $this->queue = $queue;
  22. }
  23. /**
  24. * Create a new batch instance.
  25. *
  26. * @param \Illuminate\Bus\BatchRepository $repository
  27. * @param string $id
  28. * @param string $name
  29. * @param int $totalJobs
  30. * @param int $pendingJobs
  31. * @param int $failedJobs
  32. * @param array $failedJobIds
  33. * @param array $options
  34. * @param \Carbon\CarbonImmutable $createdAt
  35. * @param \Carbon\CarbonImmutable|null $cancelledAt
  36. * @param \Carbon\CarbonImmutable|null $finishedAt
  37. * @return \Illuminate\Bus\Batch
  38. */
  39. public function make(BatchRepository $repository,
  40. string $id,
  41. string $name,
  42. int $totalJobs,
  43. int $pendingJobs,
  44. int $failedJobs,
  45. array $failedJobIds,
  46. array $options,
  47. CarbonImmutable $createdAt,
  48. ?CarbonImmutable $cancelledAt,
  49. ?CarbonImmutable $finishedAt)
  50. {
  51. return new Batch($this->queue, $repository, $id, $name, $totalJobs, $pendingJobs, $failedJobs, $failedJobIds, $options, $createdAt, $cancelledAt, $finishedAt);
  52. }
  53. }