QueueProcess.php 955 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\process;
  3. class QueueProcess
  4. {
  5. use Fork;
  6. public $queueName;
  7. public $queueTotal;
  8. public $index;
  9. private $option;
  10. private $isSerial;
  11. public function __construct($queueName, $queueTotal, $index, $option, $isSerial = false)
  12. {
  13. $this->queueName = $queueName;
  14. $this->queueTotal = $queueTotal;
  15. $this->index = $index;
  16. $this->option = $option;
  17. $this->isSerial = $isSerial;
  18. }
  19. public function getOption()
  20. {
  21. $option = $this->option;
  22. if ($this->isSerial) {
  23. if ($this->queueTotal > 1 && $this->index > 0) {
  24. $option['--queue'] = $this->queueName . ':' . $this->index;
  25. } else {
  26. $option['--queue'] = $this->queueName . ',' . $this->queueName . ':' . $this->index;
  27. }
  28. } else {
  29. $option['--queue'] = $this->queueName;
  30. }
  31. return $option;
  32. }
  33. }