# Documentation

Menu

## BitMatrix
in package

BitMatrix.php : 21

### Table of Contents

$bits : array<string|int, mixed>
$dimension : int
$formatInfo : FormatInformation|null
$mirror : bool
$rowSize : int
$version : Version|null
__construct() : mixed
flip() : self
  Flips the given bit. 1 << (0xf9 & 0x1f)
get() : bool
  Gets the requested bit, where true means black.
getDimension() : int
getFormatInfo() : FormatInformation|null
getVersion() : Version|null
mirror() : self
  Mirror the bit matrix in order to attempt a second reading.
readCodewords() : array<string|int, mixed>
  Reads the bits in the BitMatrix representing the finder pattern in the correct order in order to reconstruct the codewords bytes contained within the QR Code.
set() : self
  Sets the given bit to true.
setMirror() : self
  Prepare the parser for a mirrored operation.
setRegion() : self
  Sets a square region of the bit matrix to true.
buildFunctionPattern() : self
  See ISO 18004:2006 Annex E
copyBit() : int
decodeVersionInformation() : Version|null
doDecodeFormatInformation() : FormatInformation|null
numBitsDiffering() : int
readFormatInformation() : FormatInformation
  Reads format information from one of its two locations within the QR Code.
readVersion() : Version
  Reads version information from one of its two locations within the QR Code.
unmask() : void
  Implementations of this method reverse the data masking process applied to a QR Code and make its bits ready to read.
uRShift() : int

### Properties

#### $bits

BitMatrix.php : 25
`private array<string|int, mixed> $bits`

#### $dimension

BitMatrix.php : 23
`private int $dimension`

#### $formatInfo

BitMatrix.php : 27
`private FormatInformation|null $formatInfo = null`

#### $mirror

BitMatrix.php : 28
`private bool $mirror = false`

#### $rowSize

BitMatrix.php : 24
`private int $rowSize`

#### $version

BitMatrix.php : 26
`private Version|null $version = null`

### Methods

#### __construct()

BitMatrix.php : 33
`public __construct(int $dimension) : mixed`

##### Parameters

$dimension : int

##### Return values

mixed —

#### flip()

BitMatrix.php : 60

Flips the given bit. 1 << (0xf9 & 0x1f)

`public flip(int $x, int $y) : self`

##### Parameters

$x : int

  ; The horizontal component (i.e. which column)

$y : int

  ; The vertical component (i.e. which row)

##### Return values

self —

#### get()

BitMatrix.php : 136

Gets the requested bit, where true means black.

`public get(int $x, int $y) : bool`

##### Parameters

$x : int

  The horizontal component (i.e. which column)

$y : int

  The vertical component (i.e. which row)

##### Return values

bool —

value of given bit in matrix

#### getDimension()

BitMatrix.php : 110
`public getDimension() : int`

##### Return values

int —

The dimension (width/height) of the matrix

#### getFormatInfo()

BitMatrix.php : 117
`public getFormatInfo() : FormatInformation|null`

##### Return values

FormatInformation|null —

#### getVersion()

BitMatrix.php : 124
`public getVersion() : Version|null`

##### Return values

Version|null —

#### mirror()

BitMatrix.php : 193

Mirror the bit matrix in order to attempt a second reading.

`public mirror() : self`

##### Return values

self —

#### readCodewords()

BitMatrix.php : 260

Reads the bits in the BitMatrix representing the finder pattern in the correct order in order to reconstruct the codewords bytes contained within the QR Code.

`public readCodewords() : array<string|int, mixed>`

##### Tags

throws
  QRCodeDecoderException

  if the exact number of bytes expected is not read

##### Return values

array<string|int, mixed> —

bytes encoded within the QR Code

#### set()

BitMatrix.php : 45

Sets the given bit to true.

`public set(int $x, int $y) : self`

##### Parameters

$x : int

  ; The horizontal component (i.e. which column)

$y : int

  ; The vertical component (i.e. which row)

##### Return values

self —

#### setMirror()

BitMatrix.php : 232

Prepare the parser for a mirrored operation.

`public setMirror(bool $mirror) : self`

This flag has effect only on the readFormatInformation() and the readVersion() methods. Before proceeding with readCodewords() the mirror() method should be called.

##### Parameters

$mirror : bool

  Whether to read version and format information mirrored.

##### Return values

self —

#### setRegion()

BitMatrix.php : 78

Sets a square region of the bit matrix to true.

`public setRegion(int $left, int $top, int $width, int $height) : self`

##### Parameters

$left : int

  ; The horizontal position to begin at (inclusive)

$top : int

  ; The vertical position to begin at (inclusive)

$width : int

  ; The width of the region

$height : int

  ; The height of the region

##### Tags

throws
  QRCodeDecoderException

##### Return values

self —

#### buildFunctionPattern()

BitMatrix.php : 147

See ISO 18004:2006 Annex E

`private buildFunctionPattern() : self`

##### Return values

self —

#### copyBit()

BitMatrix.php : 243
`private copyBit(int $i, int $j, int $versionBits) : int`

##### Parameters

$i : int
$j : int
$versionBits : int

##### Return values

int —

#### decodeVersionInformation()

BitMatrix.php : 482
`private decodeVersionInformation(int $versionBits) : Version|null`

##### Parameters

$versionBits : int

##### Return values

Version|null —

#### doDecodeFormatInformation()

BitMatrix.php : 385
`private doDecodeFormatInformation(int $maskedFormatInfo1, int $maskedFormatInfo2) : FormatInformation|null`

##### Parameters

$maskedFormatInfo1 : int

  format info indicator, with mask still applied

$maskedFormatInfo2 : int

  second copy of same info; both are checked at the same time to establish best match

##### Return values

FormatInformation|null —

information about the format it specifies, or null if doesn't seem to match any known pattern

#### numBitsDiffering()

BitMatrix.php : 530
`private numBitsDiffering(int $a, int $b) : int`

##### Parameters

$a : int
$b : int

##### Return values

int —

#### readFormatInformation()

BitMatrix.php : 323

Reads format information from one of its two locations within the QR Code.

`private readFormatInformation() : FormatInformation`

##### Tags

throws
  QRCodeDecoderException

  if both format information locations cannot be parsed as the valid encoding of format information

##### Return values

FormatInformation —

encapsulating the QR Code's format info

#### readVersion()

BitMatrix.php : 431

Reads version information from one of its two locations within the QR Code.

`private readVersion() : Version`

##### Tags

throws
  QRCodeDecoderException

  if both version information locations cannot be parsed as the valid encoding of version information

noinspection

  DuplicatedCode

##### Return values

Version —

encapsulating the QR Code's version

#### unmask()

BitMatrix.php : 211

Implementations of this method reverse the data masking process applied to a QR Code and make its bits ready to read.

`private unmask() : void`

##### Return values

void —

#### uRShift()

BitMatrix.php : 518
`private uRShift(int $a, int $b) : int`

##### Parameters

$a : int
$b : int

##### Return values

int —

## Search results