Documentation

EccLevel
in package

This class encapsulates the four error correction levels defined by the QR code standard.

Table of Contents

H  = 0b10
L  = 0b1
M  = 0b0
Q  = 0b11
FORMAT_PATTERN  = [[ // L 0b111011111000100, 0b111001011110011, 0b111110110101010, 0b111100010011101, 0b110011000101111, 0b110001100011000, 0b110110001000001, 0b110100101110110, ], [ // M 0b101010000010010, 0b101000100100101, 0b101111001111100, 0b101101101001011, 0b100010111111001, 0b100000011001110, 0b100111110010111, 0b100101010100000, ], [ // Q 0b11010101011111, 0b11000001101000, 0b11111100110001, 0b11101000000110, 0b10010010110100, 0b10000110000011, 0b10111011011010, 0b10101111101101, ], [ // H 0b1011010001001, 0b1001110111110, 0b1110011100111, 0b1100111010000, 0b11101100010, 0b1001010101, 0b110100001100, 0b100000111011, ]]
ISO/IEC 18004:2000 Section 8.9 - Format Information
MAX_BITS  = [ // v => [ L, M, Q, H] // modules 1 => [152, 128, 104, 72], // 21 2 => [272, 224, 176, 128], // 25 3 => [440, 352, 272, 208], // 29 4 => [640, 512, 384, 288], // 33 5 => [864, 688, 496, 368], // 37 6 => [1088, 864, 608, 480], // 41 7 => [1248, 992, 704, 528], // 45 8 => [1552, 1232, 880, 688], // 49 9 => [1856, 1456, 1056, 800], // 53 10 => [2192, 1728, 1232, 976], // 57 11 => [2592, 2032, 1440, 1120], // 61 12 => [2960, 2320, 1648, 1264], // 65 13 => [3424, 2672, 1952, 1440], // 69 NICE! 14 => [3688, 2920, 2088, 1576], // 73 15 => [4184, 3320, 2360, 1784], // 77 16 => [4712, 3624, 2600, 2024], // 81 17 => [5176, 4056, 2936, 2264], // 85 18 => [5768, 4504, 3176, 2504], // 89 19 => [6360, 5016, 3560, 2728], // 93 20 => [6888, 5352, 3880, 3080], // 97 21 => [7456, 5712, 4096, 3248], // 101 22 => [8048, 6256, 4544, 3536], // 105 23 => [8752, 6880, 4912, 3712], // 109 24 => [9392, 7312, 5312, 4112], // 113 25 => [10208, 8000, 5744, 4304], // 117 26 => [10960, 8496, 6032, 4768], // 121 27 => [11744, 9024, 6464, 5024], // 125 28 => [12248, 9544, 6968, 5288], // 129 29 => [13048, 10136, 7288, 5608], // 133 30 => [13880, 10984, 7880, 5960], // 137 31 => [14744, 11640, 8264, 6344], // 141 32 => [15640, 12328, 8920, 6760], // 145 33 => [16568, 13048, 9368, 7208], // 149 34 => [17528, 13800, 9848, 7688], // 153 35 => [18448, 14496, 10288, 7888], // 157 36 => [19472, 15312, 10832, 8432], // 161 37 => [20528, 15936, 11408, 8768], // 165 38 => [21616, 16816, 12016, 9136], // 169 39 => [22496, 17728, 12656, 9776], // 173 40 => [23648, 18672, 13328, 10208], ]
ISO/IEC 18004:2000 Tables 7-11 - Number of symbol characters and input data capacity for versions 1 to 40
$eccLevel  : int
The current ECC level value
__construct()  : mixed
__toString()  : string
returns the string representation of the current ECC level
getformatPattern()  : int
returns the format pattern for the given $eccLevel and $maskPattern
getLevel()  : int
returns the current ECC level
getMaxBits()  : array<string|int, int>
returns an array with the max bit lengths for version 1-40 and the current ECC level
getOrdinal()  : int
returns the ordinal value of the current ECC level

Constants

FORMAT_PATTERN

ISO/IEC 18004:2000 Section 8.9 - Format Information

private array<string|int, array<string|int, int>> FORMAT_PATTERN = [[ // L 0b111011111000100, 0b111001011110011, 0b111110110101010, 0b111100010011101, 0b110011000101111, 0b110001100011000, 0b110110001000001, 0b110100101110110, ], [ // M 0b101010000010010, 0b101000100100101, 0b101111001111100, 0b101101101001011, 0b100010111111001, 0b100000011001110, 0b100111110010111, 0b100101010100000, ], [ // Q 0b11010101011111, 0b11000001101000, 0b11111100110001, 0b11101000000110, 0b10010010110100, 0b10000110000011, 0b10111011011010, 0b10101111101101, ], [ // H 0b1011010001001, 0b1001110111110, 0b1110011100111, 0b1100111010000, 0b11101100010, 0b1001010101, 0b110100001100, 0b100000111011, ]]

ECC level -> mask pattern

MAX_BITS

ISO/IEC 18004:2000 Tables 7-11 - Number of symbol characters and input data capacity for versions 1 to 40

private int MAX_BITS = [ // v => [ L, M, Q, H] // modules 1 => [152, 128, 104, 72], // 21 2 => [272, 224, 176, 128], // 25 3 => [440, 352, 272, 208], // 29 4 => [640, 512, 384, 288], // 33 5 => [864, 688, 496, 368], // 37 6 => [1088, 864, 608, 480], // 41 7 => [1248, 992, 704, 528], // 45 8 => [1552, 1232, 880, 688], // 49 9 => [1856, 1456, 1056, 800], // 53 10 => [2192, 1728, 1232, 976], // 57 11 => [2592, 2032, 1440, 1120], // 61 12 => [2960, 2320, 1648, 1264], // 65 13 => [3424, 2672, 1952, 1440], // 69 NICE! 14 => [3688, 2920, 2088, 1576], // 73 15 => [4184, 3320, 2360, 1784], // 77 16 => [4712, 3624, 2600, 2024], // 81 17 => [5176, 4056, 2936, 2264], // 85 18 => [5768, 4504, 3176, 2504], // 89 19 => [6360, 5016, 3560, 2728], // 93 20 => [6888, 5352, 3880, 3080], // 97 21 => [7456, 5712, 4096, 3248], // 101 22 => [8048, 6256, 4544, 3536], // 105 23 => [8752, 6880, 4912, 3712], // 109 24 => [9392, 7312, 5312, 4112], // 113 25 => [10208, 8000, 5744, 4304], // 117 26 => [10960, 8496, 6032, 4768], // 121 27 => [11744, 9024, 6464, 5024], // 125 28 => [12248, 9544, 6968, 5288], // 129 29 => [13048, 10136, 7288, 5608], // 133 30 => [13880, 10984, 7880, 5960], // 137 31 => [14744, 11640, 8264, 6344], // 141 32 => [15640, 12328, 8920, 6760], // 145 33 => [16568, 13048, 9368, 7208], // 149 34 => [17528, 13800, 9848, 7688], // 153 35 => [18448, 14496, 10288, 7888], // 157 36 => [19472, 15312, 10832, 8432], // 161 37 => [20528, 15936, 11408, 8768], // 165 38 => [21616, 16816, 12016, 9136], // 169 39 => [22496, 17728, 12656, 9776], // 173 40 => [23648, 18672, 13328, 10208], ]

[][]

Properties

$eccLevel

The current ECC level value

private int $eccLevel

L: 0b01 M: 0b00 Q: 0b11 H: 0b10

Methods

__construct()

public __construct(int $eccLevel) : mixed
Parameters
$eccLevel : int

containing the two bits encoding a QR Code's error correction level

Tags
throws
QRCodeException
Return values
mixed

__toString()

returns the string representation of the current ECC level

public __toString() : string
Return values
string

getformatPattern()

returns the format pattern for the given $eccLevel and $maskPattern

public getformatPattern(MaskPattern $maskPattern) : int
Parameters
$maskPattern : MaskPattern
Return values
int

getLevel()

returns the current ECC level

public getLevel() : int
Return values
int

getMaxBits()

returns an array with the max bit lengths for version 1-40 and the current ECC level

public getMaxBits() : array<string|int, int>
Return values
array<string|int, int>

Search results