Menu

## Decoder
in package

Decoder.php : 26

The main class which implements QR Code decoding -- as opposed to locating and extracting the QR Code from an image.

##### Tags

author

  Sean Owen

### Table of Contents

$eccLevel : EccLevel|null
$maskPattern : MaskPattern|null
$version : Version|null
decode() : DecoderResult
  Decodes a QR Code represented as a BitMatrix.
decodeBitStream() : DecoderResult
decodeMatrix() : DecoderResult
getDataBlocks() : array<string|int, mixed>
  When QR Codes use multiple data blocks, they are actually interleaved.

### Properties

#### $eccLevel

Decoder.php : 31
`private EccLevel|null $eccLevel = null`

#### $maskPattern

Decoder.php : 32
`private MaskPattern|null $maskPattern = null`

#### $version

Decoder.php : 30
`private Version|null $version = null`

### Methods

#### decode()

Decoder.php : 43

Decodes a QR Code represented as a BitMatrix.

`public decode(LuminanceSourceInterface $source) : DecoderResult`

A 1 or "true" is taken to mean a black module.

##### Parameters

$source : LuminanceSourceInterface

##### Tags

throws
  Throwable|QRCodeDecoderException

  if the QR Code cannot be decoded

##### Return values

DecoderResult —

text and bytes encoded within the QR Code

#### decodeBitStream()

Decoder.php : 171
`private decodeBitStream(array<string|int, mixed> $bytes) : DecoderResult`

##### Parameters

$bytes : array<string|int, mixed>

##### Tags

throws
  QRCodeDecoderException

##### Return values

DecoderResult —

#### decodeMatrix()

Decoder.php : 75
`private decodeMatrix(BitMatrix $matrix) : DecoderResult`

##### Parameters

$matrix : BitMatrix

##### Tags

throws
  QRCodeDecoderException

##### Return values

DecoderResult —

#### getDataBlocks()

Decoder.php : 101

When QR Codes use multiple data blocks, they are actually interleaved.

`private getDataBlocks(array<string|int, mixed> $rawCodewords) : array<string|int, mixed>`

That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This method will separate the data into original blocks.

##### Parameters

$rawCodewords : array<string|int, mixed>

  bytes as read directly from the QR Code

##### Tags

throws
  QRCodeDecoderException

##### Return values

array<string|int, mixed> —

DataBlocks containing original bytes, "de-interleaved" from representation in the QR Code

## Search results