EcBlock.php 1000 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. declare(strict_types = 1);
  3. namespace BaconQrCode\Common;
  4. /**
  5. * Encapsulates the parameters for one error-correction block in one symbol version.
  6. *
  7. * This includes the number of data codewords, and the number of times a block with these parameters is used
  8. * consecutively in the QR code version's format.
  9. */
  10. final class EcBlock
  11. {
  12. /**
  13. * How many times the block is used.
  14. *
  15. * @var int
  16. */
  17. private $count;
  18. /**
  19. * Number of data codewords.
  20. *
  21. * @var int
  22. */
  23. private $dataCodewords;
  24. public function __construct(int $count, int $dataCodewords)
  25. {
  26. $this->count = $count;
  27. $this->dataCodewords = $dataCodewords;
  28. }
  29. /**
  30. * Returns how many times the block is used.
  31. */
  32. public function getCount() : int
  33. {
  34. return $this->count;
  35. }
  36. /**
  37. * Returns the number of data codewords.
  38. */
  39. public function getDataCodewords() : int
  40. {
  41. return $this->dataCodewords;
  42. }
  43. }