JobId.php 455 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Pheanstalk;
  3. use Pheanstalk\Contract\JobIdInterface;
  4. /**
  5. * This class implements a value object for beanstalkd job IDs.
  6. */
  7. class JobId implements JobIdInterface
  8. {
  9. private $id;
  10. public function __construct(int $id)
  11. {
  12. if ($id < 0) {
  13. throw new \InvalidArgumentException('Id must be >= 0');
  14. }
  15. $this->id = $id;
  16. }
  17. public function getId(): int
  18. {
  19. return $this->id;
  20. }
  21. }