QRDataModeInterface.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Interface QRDataModeInterface
  4. *
  5. * @created 01.12.2015
  6. * @author Smiley <smiley@chillerlan.net>
  7. * @copyright 2015 Smiley
  8. * @license MIT
  9. */
  10. namespace chillerlan\QRCode\Data;
  11. use chillerlan\QRCode\Common\BitBuffer;
  12. /**
  13. * Specifies the methods reqired for the data modules (Number, Alphanum, Byte and Kanji)
  14. */
  15. interface QRDataModeInterface{
  16. /**
  17. * returns the current data mode constant
  18. */
  19. public function getDataMode():int;
  20. /**
  21. * retruns the length in bits of the data string
  22. */
  23. public function getLengthInBits():int;
  24. /**
  25. * checks if the given string qualifies for the encoder module
  26. */
  27. public static function validateString(string $string):bool;
  28. /**
  29. * writes the actual data string to the BitBuffer, uses the given version to determine the length bits
  30. *
  31. * @see \chillerlan\QRCode\Data\QRData::writeBitBuffer()
  32. */
  33. public function write(BitBuffer $bitBuffer, int $versionNumber):void;
  34. /**
  35. * reads a segment from the BitBuffer and decodes in the current data mode
  36. */
  37. public static function decodeSegment(BitBuffer $bitBuffer, int $versionNumber):string;
  38. }