QRDataModeInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. * and holds version information in several constants
  15. */
  16. interface QRDataModeInterface{
  17. /**
  18. * returns the current data mode constant
  19. */
  20. public function getDataMode():int;
  21. /**
  22. * retruns the length in bits of the data string
  23. */
  24. public function getLengthInBits():int;
  25. /**
  26. * checks if the given string qualifies for the encoder module
  27. */
  28. public static function validateString(string $string):bool;
  29. /**
  30. * writes the actual data string to the BitBuffer, uses the given version to determine the length bits
  31. *
  32. * @see \chillerlan\QRCode\Data\QRData::writeBitBuffer()
  33. */
  34. public function write(BitBuffer $bitBuffer, int $versionNumber):void;
  35. /**
  36. * reads a segment from the BitBuffer and decodes in the current data mode
  37. */
  38. public static function decodeSegment(BitBuffer $bitBuffer, int $versionNumber):string;
  39. }