BlockPair.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. declare(strict_types = 1);
  3. namespace BaconQrCode\Encoder;
  4. use SplFixedArray;
  5. /**
  6. * Block pair.
  7. */
  8. final class BlockPair
  9. {
  10. /**
  11. * Data bytes in the block.
  12. *
  13. * @var SplFixedArray<int>
  14. */
  15. private $dataBytes;
  16. /**
  17. * Error correction bytes in the block.
  18. *
  19. * @var SplFixedArray<int>
  20. */
  21. private $errorCorrectionBytes;
  22. /**
  23. * Creates a new block pair.
  24. *
  25. * @param SplFixedArray<int> $data
  26. * @param SplFixedArray<int> $errorCorrection
  27. */
  28. public function __construct(SplFixedArray $data, SplFixedArray $errorCorrection)
  29. {
  30. $this->dataBytes = $data;
  31. $this->errorCorrectionBytes = $errorCorrection;
  32. }
  33. /**
  34. * Gets the data bytes.
  35. *
  36. * @return SplFixedArray<int>
  37. */
  38. public function getDataBytes() : SplFixedArray
  39. {
  40. return $this->dataBytes;
  41. }
  42. /**
  43. * Gets the error correction bytes.
  44. *
  45. * @return SplFixedArray<int>
  46. */
  47. public function getErrorCorrectionBytes() : SplFixedArray
  48. {
  49. return $this->errorCorrectionBytes;
  50. }
  51. }