Total Complexity | 6 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | abstract class QRDataModeAbstract implements QRDataModeInterface{ |
||
18 | |||
19 | /** |
||
20 | * the current data mode: Num, Alphanum, Kanji, Byte |
||
21 | */ |
||
22 | protected static int $datamode; |
||
23 | |||
24 | /** |
||
25 | * The data to write |
||
26 | */ |
||
27 | protected string $data; |
||
28 | |||
29 | /** |
||
30 | * QRDataModeAbstract constructor. |
||
31 | * |
||
32 | * @throws \chillerlan\QRCode\Data\QRCodeDataException |
||
33 | */ |
||
34 | public function __construct(string $data){ |
||
35 | $data = $this::convertEncoding($data); |
||
36 | |||
37 | if(!$this::validateString($data)){ |
||
38 | throw new QRCodeDataException('invalid data'); |
||
39 | } |
||
40 | |||
41 | $this->data = $data; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * returns the character count of the $data string |
||
46 | */ |
||
47 | protected function getCharCount():int{ |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @inheritDoc |
||
53 | */ |
||
54 | public function getDataMode():int{ |
||
55 | return $this::$datamode; |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * shortcut |
||
60 | */ |
||
61 | protected static function getLengthBits(int $versionNumber):int{ |
||
62 | return Mode::getLengthBitsForVersion(static::$datamode, $versionNumber); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * encoding conversion helper |
||
67 | * |
||
68 | * @throws \chillerlan\QRCode\Data\QRCodeDataException |
||
69 | */ |
||
70 | public static function convertEncoding(string $string):string{ |
||
72 | } |
||
73 | |||
74 | } |
||
75 |