\BaconQrCode\CommonFormatInformation

Encapsulates a QR Code's format information, including the data mask used and error correction level.

Summary

Methods
Properties
Constants
numBitsDiffering()
decodeFormatInformation()
getErrorCorrectionLevel()
getDataMask()
hashCode()
equals()
No public properties found
FORMAT_INFO_MASK_QR
FORMAT_INFO_DECODE_LOOKUP
BITS_SET_IN_HALF_BYTE
__construct()
No protected properties found
N/A
doDecodeFormatInformation()
$ecLevel
$dataMask
N/A

Constants

FORMAT_INFO_MASK_QR

FORMAT_INFO_MASK_QR = 0x5412

Mask for format information.

FORMAT_INFO_DECODE_LOOKUP

FORMAT_INFO_DECODE_LOOKUP = [[0x5412, 0x0], [0x5125, 0x1], [0x5e7c, 0x2], [0x5b4b, 0x3], [0x45f9, 0x4], [0x40ce, 0x5], [0x4f97, 0x6], [0x4aa0, 0x7], [0x77c4, 0x8], [0x72f3, 0x9], [0x7daa, 0xa], [0x789d, 0xb], [0x662f, 0xc], [0x6318, 0xd], [0x6c41, 0xe], [0x6976, 0xf], [0x1689, 0x10], [0x13be, 0x11], [0x1ce7, 0x12], [0x19d0, 0x13], [0x762, 0x14], [0x255, 0x15], [0xd0c, 0x16], [0x83b, 0x17], [0x355f, 0x18], [0x3068, 0x19], [0x3f31, 0x1a], [0x3a06, 0x1b], [0x24b4, 0x1c], [0x2183, 0x1d], [0x2eda, 0x1e], [0x2bed, 0x1f]]

Lookup table for decoding format information.

See ISO 18004:2006, Annex C, Table C.1

BITS_SET_IN_HALF_BYTE

BITS_SET_IN_HALF_BYTE = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4] : array

Offset i holds the number of 1 bits in the binary representation of i.

Properties

$ecLevel

$ecLevel : \BaconQrCode\Common\ErrorCorrectionLevel

Error correction level.

Type

ErrorCorrectionLevel

$dataMask

$dataMask : int

Data mask.

Type

int

Methods

numBitsDiffering()

numBitsDiffering(int  $a, int  $b) : int

Checks how many bits are different between two integers.

Parameters

int $a
int $b

Returns

int —

decodeFormatInformation()

decodeFormatInformation(int  $maskedFormatInfo1, int  $maskedFormatInfo2) : ?self

Decodes format information.

Parameters

int $maskedFormatInfo1
int $maskedFormatInfo2

Returns

?self —

getErrorCorrectionLevel()

getErrorCorrectionLevel() : \BaconQrCode\Common\ErrorCorrectionLevel

Returns the error correction level.

Returns

\BaconQrCode\Common\ErrorCorrectionLevel —

getDataMask()

getDataMask() : int

Returns the data mask.

Returns

int —

hashCode()

hashCode() : int

Hashes the code of the EC level.

Returns

int —

equals()

equals(self  $other) : bool

Verifies if this instance equals another one.

Parameters

self $other

Returns

bool —

__construct()

__construct(int  $formatInfo) : mixed

Parameters

int $formatInfo

Returns

mixed —

doDecodeFormatInformation()

doDecodeFormatInformation(int  $maskedFormatInfo1, int  $maskedFormatInfo2) : ?self

Internal method for decoding format information.

Parameters

int $maskedFormatInfo1
int $maskedFormatInfo2

Returns

?self —