PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.20
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.20
1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 All 164 releases
woocommerce-pos / vendor_prefixed / chillerlan / php-qrcode / src / Data / QRDataModeAbstract.php

QRDataModeAbstract.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.20, at vendor_prefixed/chillerlan/php-qrcode/src/Data/QRDataModeAbstract.php

58 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class QRDataModeAbstract
5 *
6 * @created 19.11.2020
7 * @author smiley <[email protected]>
8 * @copyright 2020 smiley
9 * @license MIT
10 */
11 namespace WCPOS\Vendor\chillerlan\QRCode\Data;
12
13 use WCPOS\Vendor\chillerlan\QRCode\Common\Mode;
14 /**
15 * abstract methods for the several data modes
16 */
17 abstract class QRDataModeAbstract implements QRDataModeInterface
18 {
19 /**
20 * The data to write
21 */
22 protected string $data;
23 /**
24 * QRDataModeAbstract constructor.
25 *
26 * @throws \chillerlan\QRCode\Data\QRCodeDataException
27 */
28 public function __construct(string $data)
29 {
30 $data = $this::convertEncoding($data);
31 if (!$this::validateString($data)) {
32 throw new QRCodeDataException('invalid data');
33 }
34 $this->data = $data;
35 }
36 /**
37 * returns the character count of the $data string
38 */
39 protected function getCharCount() : int
40 {
41 return \strlen($this->data);
42 }
43 /**
44 * @inheritDoc
45 */
46 public static function convertEncoding(string $string) : string
47 {
48 return $string;
49 }
50 /**
51 * shortcut
52 */
53 protected static function getLengthBits(int $versionNumber) : int
54 {
55 return Mode::getLengthBitsForVersion(static::DATAMODE, $versionNumber);
56 }
57 }
58