PluginProbe ʕ •ᴥ•ʔ
WP 2FA – Two-factor authentication for WordPress / 4.0.0
WP 2FA – Two-factor authentication for WordPress v4.0.0
4.0.0 1.7.1 2.0.0 2.0.1 2.1.0 2.2.0 2.2.1 2.3.0 2.4.0 2.4.1 2.4.2 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.8.0 2.9.0 2.9.1 2.9.2 2.9.3 3.0.0 3.0.1 3.1.0 3.1.1 3.1.1.2 trunk 1.2.0 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.7.0
wp-2fa / includes / classes / bacon / bacon-qr-code / src / Common / Mode.php
wp-2fa / includes / classes / bacon / bacon-qr-code / src / Common Last commit date
BitArray.php 1 week ago BitMatrix.php 1 week ago BitUtils.php 1 week ago CharacterSetEci.php 1 week ago EcBlock.php 1 week ago EcBlocks.php 1 week ago ErrorCorrectionLevel.php 1 week ago FormatInformation.php 1 week ago Mode.php 1 week ago ReedSolomonCodec.php 1 week ago Version.php 1 week ago index.php 1 week ago
Mode.php
72 lines
1 <?php
2
3 declare (strict_types=1);
4 namespace WP2FA_Vendor\BaconQrCode\Common;
5
6 use WP2FA_Vendor\DASPRiD\Enum\AbstractEnum;
7 /**
8 * Enum representing various modes in which data can be encoded to bits.
9 *
10 * @method static self TERMINATOR()
11 * @method static self NUMERIC()
12 * @method static self ALPHANUMERIC()
13 * @method static self STRUCTURED_APPEND()
14 * @method static self BYTE()
15 * @method static self ECI()
16 * @method static self KANJI()
17 * @method static self FNC1_FIRST_POSITION()
18 * @method static self FNC1_SECOND_POSITION()
19 * @method static self HANZI()
20 */
21 final class Mode extends AbstractEnum
22 {
23 protected const TERMINATOR = [[0, 0, 0], 0x0];
24 protected const NUMERIC = [[10, 12, 14], 0x1];
25 protected const ALPHANUMERIC = [[9, 11, 13], 0x2];
26 protected const STRUCTURED_APPEND = [[0, 0, 0], 0x3];
27 protected const BYTE = [[8, 16, 16], 0x4];
28 protected const ECI = [[0, 0, 0], 0x7];
29 protected const KANJI = [[8, 10, 12], 0x8];
30 protected const FNC1_FIRST_POSITION = [[0, 0, 0], 0x5];
31 protected const FNC1_SECOND_POSITION = [[0, 0, 0], 0x9];
32 protected const HANZI = [[8, 10, 12], 0xd];
33 /**
34 * @var int[]
35 */
36 private $characterCountBitsForVersions;
37 /**
38 * @var int
39 */
40 private $bits;
41 /**
42 * @param int[] $characterCountBitsForVersions
43 */
44 protected function __construct(array $characterCountBitsForVersions, int $bits)
45 {
46 $this->characterCountBitsForVersions = $characterCountBitsForVersions;
47 $this->bits = $bits;
48 }
49 /**
50 * Returns the number of bits used in a specific QR code version.
51 */
52 public function getCharacterCountBits(Version $version) : int
53 {
54 $number = $version->getVersionNumber();
55 if ($number <= 9) {
56 $offset = 0;
57 } elseif ($number <= 26) {
58 $offset = 1;
59 } else {
60 $offset = 2;
61 }
62 return $this->characterCountBitsForVersions[$offset];
63 }
64 /**
65 * Returns the four bits used to encode this mode.
66 */
67 public function getBits() : int
68 {
69 return $this->bits;
70 }
71 }
72