Job.php 931 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace Pheanstalk;
  3. use Pheanstalk\Contract\JobIdInterface;
  4. /**
  5. * A job in a beanstalkd server.
  6. */
  7. class Job implements JobIdInterface
  8. {
  9. const STATUS_READY = 'ready';
  10. const STATUS_RESERVED = 'reserved';
  11. const STATUS_DELAYED = 'delayed';
  12. const STATUS_BURIED = 'buried';
  13. /**
  14. * @var int
  15. */
  16. private $id;
  17. /**
  18. * @var string
  19. */
  20. private $data;
  21. /**
  22. * @param int $id The job ID
  23. * @param string $data The job data
  24. */
  25. public function __construct(int $id, string $data)
  26. {
  27. $this->id = $id;
  28. $this->data = $data;
  29. }
  30. /**
  31. * The job ID, unique on the beanstalkd server.
  32. *
  33. * @return int
  34. */
  35. public function getId(): int
  36. {
  37. return $this->id;
  38. }
  39. /**
  40. * The job data.
  41. *
  42. * @return string
  43. */
  44. public function getData(): string
  45. {
  46. return $this->data;
  47. }
  48. }