Debian Codegraph @

vendor/chillerlan/php-qrcode/src/Data/QRDataModeInterface.php

raw
1 <?php
2 /**
3 * Interface QRDataModeInterface
4 *
5 * @created 01.12.2015
6 * @author Smiley <[email protected]>
7 * @copyright 2015 Smiley
8 * @license MIT
9 */
10 declare(strict_types=1);
11
12 namespace chillerlan\QRCode\Data;
13
14 use chillerlan\QRCode\Common\BitBuffer;
15
16 /**
17 * Specifies the methods reqired for the data modules (Number, Alphanum, Byte and Kanji)
18 */
19 interface QRDataModeInterface{
20
21 /**
22 * the current data mode: Number, Alphanum, Kanji, Hanzi, Byte, ECI
23 *
24 * Note: do not call this constant from the interface, but rather from one of the child classes
25 *
26 * @var int
27 * @see \chillerlan\QRCode\Common\Mode
28 */
29 public const DATAMODE = -1;
30
31 /**
32 * retruns the length in bits of the data string
33 */
34 public function getLengthInBits():int;
35
36 /**
37 * encoding conversion helper
38 *
39 * @throws \chillerlan\QRCode\Data\QRCodeDataException
40 */
41 public static function convertEncoding(string $string):string;
42
43 /**
44 * checks if the given string qualifies for the encoder module
45 */
46 public static function validateString(string $string):bool;
47
48 /**
49 * writes the actual data string to the BitBuffer, uses the given version to determine the length bits
50 *
51 * @see \chillerlan\QRCode\Data\QRData::writeBitBuffer()
52 */
53 public function write(BitBuffer $bitBuffer, int $versionNumber):static;
54
55 /**
56 * reads a segment from the BitBuffer and decodes in the current data mode
57 */
58 public function decodeSegment(BitBuffer $bitBuffer, int $versionNumber):string;
59
60 }