Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
QRcode Class Reference

Class to create QR-code arrays for TCPDF class. More...

Public Member Functions

 __construct ($code, $eclevel='L')
 This is the class constructor.
 
 getBarcodeArray ()
 Returns a barcode array which is readable by TCPDF.
 

Protected Member Functions

 allocate ($setLength)
 Return an array with zeros.
 
 appendBitstream ($bitstream, $append)
 Append one bitstream to another.
 
 appendBytes ($bitstream, $size, $data)
 Append one bitstream created from bytes to another.
 
 appendNewInputItem ($items, $mode, $size, $data)
 Append data to an input object.
 
 appendNum ($bitstream, $bits, $num)
 Append one bitstream created from number to another.
 
 appendPaddingBit ($bstream)
 Append Padding Bit to bitstream.
 
 binarize ($frame)
 Convert the frame in binary form.
 
 bitstreamToByte ($bstream)
 Convert bitstream to bytes.
 
 calcN1N3 ($length)
 calcN1N3
 
 calcParity ($items)
 calcParity
 
 check ($mode, $size, $data)
 Validate the input data.
 
 checkModeAn ($size, $data)
 checkModeAn
 
 checkModeKanji ($size, $data)
 checkModeKanji
 
 checkModeNum ($size, $data)
 checkModeNum
 
 convertData ($items)
 convertData
 
 createBitStream ($items)
 createBitStream
 
 createFrame ($version)
 Return a copy of initialized frame.
 
 eat8 ()
 eat8
 
 eatAn ()
 eatAn
 
 eatKanji ()
 eatKanji
 
 eatNum ()
 eatNum
 
 encode_rs_char ($rs, $data, $parity)
 Encode a Reed-Solomon codec and returns the parity array.
 
 encodeBitStream ($inputitem, $version)
 encodeBitStream
 
 encodeMask ($mask)
 Encode mask.
 
 encodeMode8 ($inputitem, $version)
 encodeMode8
 
 encodeModeAn ($inputitem, $version)
 encodeModeAn
 
 encodeModeKanji ($inputitem, $version)
 encodeModeKanji
 
 encodeModeNum ($inputitem, $version)
 encodeModeNum
 
 encodeModeStructure ($inputitem)
 encodeModeStructure
 
 encodeString ($string)
 Encode the input string to QR code.
 
 estimateBitsMode8 ($size)
 estimateBitsMode8
 
 estimateBitsModeAn ($size)
 estimateBitsModeAn
 
 estimateBitsModeKanji ($size)
 estimateBitsModeKanji
 
 estimateBitsModeNum ($size)
 estimateBitsModeNum
 
 estimateBitStreamSize ($items, $version)
 estimateBitStreamSize
 
 estimateVersion ($items)
 estimateVersion
 
 evaluateSymbol ($width, $frame)
 evaluateSymbol
 
 generateMaskNo ($maskNo, $width, $frame)
 Return bitmask.
 
 getBitStream ($items)
 Returns a stream of bits.
 
 getByteStream ($items)
 Pack all bit streams padding bits into a byte array.
 
 getCode ()
 Return Reed-Solomon block code.
 
 getDataLength ($version, $level)
 Return maximum data code length (bytes) for the version.
 
 getECCLength ($version, $level)
 Return maximum error correction code length (bytes) for the version.
 
 getEccSpec ($version, $level, $spec)
 Return an array of ECC specification.
 
 getFormatInfo ($mask, $level)
 Return BCH encoded format information pattern.
 
 getFrameAt ($at)
 Get frame value at specified position.
 
 getMinimumVersion ($size, $level)
 Return a version number that satisfies the input code length.
 
 getNextPosition ()
 Return the next frame position.
 
 getRemainder ($version)
 Return the numer of remainder bits.
 
 getVersionPattern ($version)
 Return BCH encoded version information pattern that is used for the symbol of version 7 or greater.
 
 getWidth ($version)
 Return the width of the symbol for the version.
 
 identifyMode ($pos)
 identifyMode
 
 init ($spec)
 Initialize code.
 
 init_rs ($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
 Initialize a Reed-Solomon codec and add it to existing rsitems.
 
 init_rs_char ($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
 Initialize a Reed-Solomon codec and returns an array of values.
 
 insertStructuredAppendHeader ($items, $size, $index, $parity)
 insertStructuredAppendHeader
 
 isalnumat ($str, $pos)
 Return true if the character at specified position is an alphanumeric character.
 
 isdigitat ($str, $pos)
 Return true if the character at specified position is a number.
 
 lengthIndicator ($mode, $version)
 Return the size of length indicator for the mode and version.
 
 lengthOfCode ($mode, $version, $bits)
 lengthOfCode
 
 lookAnTable ($c)
 Look up the alphabet-numeric conversion table (see JIS X0510:2004, pp.19).
 
 makeMask ($width, $frame, $maskNo, $level)
 makeMask
 
 makeMaskNo ($maskNo, $width, $s, &$d, $maskGenOnly=false)
 makeMaskNo
 
 mask ($width, $frame, $level)
 mask
 
 mask0 ($x, $y)
 mask0
 
 mask1 ($x, $y)
 mask1
 
 mask2 ($x, $y)
 mask2
 
 mask3 ($x, $y)
 mask3
 
 mask4 ($x, $y)
 mask4
 
 mask5 ($x, $y)
 mask5
 
 mask6 ($x, $y)
 mask6
 
 mask7 ($x, $y)
 mask7
 
 maximumWords ($mode, $version)
 Return the maximum length for the mode and version.
 
 mergeBitStream ($items)
 mergeBitStream
 
 modnn ($rs, $x)
 modnn
 
 newFrame ($version)
 Set new frame for the specified version.
 
 newFromBytes ($size, $data)
 Return new bitstream from bytes.
 
 newFromNum ($bits, $num)
 Return new bitstream from number.
 
 newInputItem ($mode, $size, $data, $bstream=null)
 newInputItem
 
 putAlignmentMarker ($frame, $ox, $oy)
 Put an alignment marker.
 
 putAlignmentPattern ($version, $frame, $width)
 Put an alignment pattern.
 
 putFinderPattern ($frame, $ox, $oy)
 Put a finder pattern.
 
 qrstrset ($srctab, $x, $y, $repl, $replLen=false)
 Replace a value on the array at the specified position.
 
 rsBlockNum ($spec)
 Return block number 0.
 
 rsBlockNum1 ($spec)
 Return block number 1.
 
 rsBlockNum2 ($spec)
 Return block number 2.
 
 rsDataCodes1 ($spec)
 Return data codes 1.
 
 rsDataCodes2 ($spec)
 Return data codes 2.
 
 rsDataLength ($spec)
 Return data length.
 
 rsEccCodes1 ($spec)
 Return ecc codes 1.
 
 rsEccCodes2 ($spec)
 Return ecc codes 2.
 
 rsEccLength ($spec)
 Return ecc length.
 
 setFrameAt ($at, $val)
 Set frame value at specified position.
 
 splitString ()
 splitString
 
 toUpper ()
 toUpper
 
 writeFormatInformation ($width, &$frame, $mask, $level)
 Write Format Information on frame and returns the number of black bits.
 

Protected Attributes

 $alignmentPattern
 Array Positions of alignment patterns.
 
 $anTable
 Alphabet-numeric convesion table.
 
 $b1
 Value b1.
 
 $barcode_array = array()
 Barcode array to be returned which is readable by TCPDF.
 
 $bit
 Single bit value.
 
 $blocks
 Blocks.
 
 $capacity
 Array Table of the capacity of symbols.
 
 $casesensitive = true
 Boolean flag, if true the input string will be converted to uppercase.
 
 $count
 Counter.
 
 $data
 Mask data.
 
 $datacode = array()
 Data code.
 
 $dataLength
 Data length.
 
 $dataStr = ''
 Input data string.
 
 $dir
 Direction.
 
 $ecccode = array()
 Error correction code.
 
 $eccLength
 Error correction length.
 
 $eccTable
 Array Table of the error correction code (Reed-Solomon block).
 
 $formatInfo
 Array Format information.
 
 $frame
 Frame.
 
 $frames = array()
 Array of frames.
 
 $hint = QR_MODE_8B
 Encoding mode.
 
 $items
 Input items.
 
 $lengthTableBits
 Array Length indicator.
 
 $level = QR_ECLEVEL_L
 Levels of error correction.
 
 $rsblocks = array()
 Reed-Solomon blocks.
 
 $rsitems = array()
 Reed-Solomon items.
 
 $runLength = array()
 Run length.
 
 $structured = 0
 Structured QR code (not supported yet).
 
 $version = 0
 QR code version.
 
 $versionPattern
 Array Version information pattern (BCH coded).
 
 $width
 Width.
 
 $x
 X position of bit.
 
 $y
 Y position of bit.
 

Detailed Description

Class to create QR-code arrays for TCPDF class.

QR Code symbol is a 2D barcode that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness. This class supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004. Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1, Structured mode.

This class is derived from "PHP QR Code encoder" by Dominik Dzienia (http://phpqrcode.sourceforge.net/) based on "libqrencode C library 3.1.1." by Kentaro Fukuchi (http://megaui.net/fukuchi/works/qrencode/index.en.html), contains Reed-Solomon code written by Phil Karn, KA9Q. QR Code is registered trademark of DENSO WAVE INCORPORATED (http://www.denso-wave.com/qrcode/index-e.html). Please read comments on this class source file for full copyright and license information.

..

Author
Nicola Asuni
Version
1.0.010

Constructor & Destructor Documentation

◆ __construct()

QRcode::__construct ( $code,
$eclevel = 'L' )

This is the class constructor.

Creates a QRcode object

Parameters
string$codecode to represent using QRcode
string$eclevelerror level:
  • L : About 7% or less errors can be corrected.
  • M : About 15% or less errors can be corrected.
  • Q : About 25% or less errors can be corrected.
  • H : About 30% or less errors can be corrected.
Since
1.0.000

Member Function Documentation

◆ allocate()

QRcode::allocate ( $setLength)
protected

Return an array with zeros.

Parameters
int$setLengtharray size
Return values
array

◆ appendBitstream()

QRcode::appendBitstream ( $bitstream,
$append )
protected

Append one bitstream to another.

Parameters
array$bitstreamoriginal bitstream
array$appendbitstream to append
Return values
arraybitstream

◆ appendBytes()

QRcode::appendBytes ( $bitstream,
$size,
$data )
protected

Append one bitstream created from bytes to another.

Parameters
array$bitstreamoriginal bitstream
int$sizesize
array$databytes
Return values
arraybitstream

◆ appendNewInputItem()

QRcode::appendNewInputItem ( $items,
$mode,
$size,
$data )
protected

Append data to an input object.

The data is copied and appended to the input object.

Parameters
array$itemsinput items
int$modeencoding mode.
int$sizesize of data (byte).
array$dataarray of input data.
Return values
arrayitems

◆ appendNum()

QRcode::appendNum ( $bitstream,
$bits,
$num )
protected

Append one bitstream created from number to another.

Parameters
array$bitstreamoriginal bitstream
int$bitsnumber of bits
int$numnumber
Return values
arraybitstream

◆ appendPaddingBit()

QRcode::appendPaddingBit ( $bstream)
protected

Append Padding Bit to bitstream.

Parameters
array$bstream
Return values
arraybitstream

◆ binarize()

QRcode::binarize ( $frame)
protected

Convert the frame in binary form.

Parameters
array$framearray to binarize
Return values
arrayframe in binary form

◆ bitstreamToByte()

QRcode::bitstreamToByte ( $bstream)
protected

Convert bitstream to bytes.

Parameters
array$bstreamoriginal bitstream
Return values
arrayof bytes

◆ calcN1N3()

QRcode::calcN1N3 ( $length)
protected

calcN1N3

Parameters
int$length
Return values
intdemerit

◆ calcParity()

QRcode::calcParity ( $items)
protected

calcParity

Parameters
array$items
Return values
intparity

◆ check()

QRcode::check ( $mode,
$size,
$data )
protected

Validate the input data.

Parameters
int$modeencoding mode.
int$sizesize of data (byte).
array$datadata to validate
Return values
booleantrue in case of valid data, false otherwise

◆ checkModeAn()

QRcode::checkModeAn ( $size,
$data )
protected

checkModeAn

Parameters
int$size
array$data
Return values
booleantrue or false

◆ checkModeKanji()

QRcode::checkModeKanji ( $size,
$data )
protected

checkModeKanji

Parameters
int$size
array$data
Return values
booleantrue or false

◆ checkModeNum()

QRcode::checkModeNum ( $size,
$data )
protected

checkModeNum

Parameters
int$size
array$data
Return values
booleantrue or false

◆ convertData()

QRcode::convertData ( $items)
protected

convertData

Parameters
array$items
Return values
arrayitems

◆ createBitStream()

QRcode::createBitStream ( $items)
protected

createBitStream

Parameters
array$items
Return values
arrayof items and total bits

◆ createFrame()

QRcode::createFrame ( $version)
protected

Return a copy of initialized frame.

Parameters
int$versionversion
Return values
arrayarray of unsigned char.

◆ eat8()

QRcode::eat8 ( )
protected

eat8

Return values
intrun

◆ eatAn()

QRcode::eatAn ( )
protected

eatAn

Return values
intrun

◆ eatKanji()

QRcode::eatKanji ( )
protected

eatKanji

Return values
intrun

◆ eatNum()

QRcode::eatNum ( )
protected

eatNum

Return values
intrun

◆ encode_rs_char()

QRcode::encode_rs_char ( $rs,
$data,
$parity )
protected

Encode a Reed-Solomon codec and returns the parity array.

Parameters
array$rsRS values
array$datadata
array$parityparity
Return values
parityarray

◆ encodeBitStream()

QRcode::encodeBitStream ( $inputitem,
$version )
protected

encodeBitStream

Parameters
array$inputitem
int$version
Return values
arrayinput item

◆ encodeMask()

QRcode::encodeMask ( $mask)
protected

Encode mask.

Parameters
int$maskmasking mode

◆ encodeMode8()

QRcode::encodeMode8 ( $inputitem,
$version )
protected

encodeMode8

Parameters
array$inputitem
int$version
Return values
arrayinput item

◆ encodeModeAn()

QRcode::encodeModeAn ( $inputitem,
$version )
protected

encodeModeAn

Parameters
array$inputitem
int$version
Return values
arrayinput item

◆ encodeModeKanji()

QRcode::encodeModeKanji ( $inputitem,
$version )
protected

encodeModeKanji

Parameters
array$inputitem
int$version
Return values
arrayinput item

◆ encodeModeNum()

QRcode::encodeModeNum ( $inputitem,
$version )
protected

encodeModeNum

Parameters
array$inputitem
int$version
Return values
arrayinput item

◆ encodeModeStructure()

QRcode::encodeModeStructure ( $inputitem)
protected

encodeModeStructure

Parameters
array$inputitem
Return values
arrayinput item

◆ encodeString()

QRcode::encodeString ( $string)
protected

Encode the input string to QR code.

Parameters
string$stringinput string to encode

◆ estimateBitsMode8()

QRcode::estimateBitsMode8 ( $size)
protected

estimateBitsMode8

Parameters
int$size
Return values
intnumber of bits

◆ estimateBitsModeAn()

QRcode::estimateBitsModeAn ( $size)
protected

estimateBitsModeAn

Parameters
int$size
Return values
intnumber of bits

◆ estimateBitsModeKanji()

QRcode::estimateBitsModeKanji ( $size)
protected

estimateBitsModeKanji

Parameters
int$size
Return values
intnumber of bits

◆ estimateBitsModeNum()

QRcode::estimateBitsModeNum ( $size)
protected

estimateBitsModeNum

Parameters
int$size
Return values
intnumber of bits

◆ estimateBitStreamSize()

QRcode::estimateBitStreamSize ( $items,
$version )
protected

estimateBitStreamSize

Parameters
array$items
int$version
Return values
intbits

◆ estimateVersion()

QRcode::estimateVersion ( $items)
protected

estimateVersion

Parameters
array$items
Return values
intversion

◆ evaluateSymbol()

QRcode::evaluateSymbol ( $width,
$frame )
protected

evaluateSymbol

Parameters
int$width
array$frame
Return values
intdemerit

◆ generateMaskNo()

QRcode::generateMaskNo ( $maskNo,
$width,
$frame )
protected

Return bitmask.

Parameters
int$maskNomask number
int$widthwidth
array$frameframe
Return values
arraybitmask

◆ getBarcodeArray()

QRcode::getBarcodeArray ( )

Returns a barcode array which is readable by TCPDF.

Return values
arraybarcode array readable by TCPDF;

◆ getBitStream()

QRcode::getBitStream ( $items)
protected

Returns a stream of bits.

Parameters
int$items
Return values
arraypadded merged byte stream

◆ getByteStream()

QRcode::getByteStream ( $items)
protected

Pack all bit streams padding bits into a byte array.

Parameters
int$items
Return values
arraypadded merged byte stream

◆ getCode()

QRcode::getCode ( )
protected

Return Reed-Solomon block code.

Return values
arrayrsblocks

◆ getDataLength()

QRcode::getDataLength ( $version,
$level )
protected

Return maximum data code length (bytes) for the version.

Parameters
int$versionversion
int$levelerror correction level
Return values
intmaximum size (bytes)

◆ getECCLength()

QRcode::getECCLength ( $version,
$level )
protected

Return maximum error correction code length (bytes) for the version.

Parameters
int$versionversion
int$levelerror correction level
Return values
intECC size (bytes)

◆ getEccSpec()

QRcode::getEccSpec ( $version,
$level,
$spec )
protected

Return an array of ECC specification.

Parameters
int$versionversion
int$levelerror correction level
array$specan array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code}
Return values
arrayspec

◆ getFormatInfo()

QRcode::getFormatInfo ( $mask,
$level )
protected

Return BCH encoded format information pattern.

Parameters
array$mask
int$levelerror correction level
Return values
stringBCH encoded format information pattern

◆ getFrameAt()

QRcode::getFrameAt ( $at)
protected

Get frame value at specified position.

Parameters
array$atx,y position
Return values
valueat specified position

◆ getMinimumVersion()

QRcode::getMinimumVersion ( $size,
$level )
protected

Return a version number that satisfies the input code length.

Parameters
int$sizeinput code length (bytes)
int$levelerror correction level
Return values
intversion number

◆ getNextPosition()

QRcode::getNextPosition ( )
protected

Return the next frame position.

Return values
arrayof x,y coordinates

◆ getRemainder()

QRcode::getRemainder ( $version)
protected

Return the numer of remainder bits.

Parameters
int$versionversion
Return values
intnumber of remainder bits

◆ getVersionPattern()

QRcode::getVersionPattern ( $version)
protected

Return BCH encoded version information pattern that is used for the symbol of version 7 or greater.

Use lower 18 bits.

Parameters
int$versionversion
Return values
stringBCH encoded version information pattern

◆ getWidth()

QRcode::getWidth ( $version)
protected

Return the width of the symbol for the version.

Parameters
int$versionversion
Return values
intwidth

◆ identifyMode()

QRcode::identifyMode ( $pos)
protected

identifyMode

Parameters
int$pos
Return values
intmode

◆ init()

QRcode::init ( $spec)
protected

Initialize code.

Parameters
array$specarray of ECC specification
Return values
int0 in case of success, -1 in case of error

◆ init_rs()

QRcode::init_rs ( $symsize,
$gfpoly,
$fcr,
$prim,
$nroots,
$pad )
protected

Initialize a Reed-Solomon codec and add it to existing rsitems.

Parameters
int$symsizesymbol size, bits
int$gfpolyField generator polynomial coefficients
int$fcrfirst root of RS code generator polynomial, index form
int$primprimitive element to generate polynomial roots
int$nrootsRS code generator polynomial degree (number of roots)
int$padpadding bytes at front of shortened block
Return values
arrayArray of RS values:
  • mm = Bits per symbol;
  • nn = Symbols per block;
  • alpha_to = log lookup table array;
  • index_of = Antilog lookup table array;
  • genpoly = Generator polynomial array;
  • nroots = Number of generator;
  • roots = number of parity symbols;
  • fcr = First consecutive root, index form;
  • prim = Primitive element, index form;
  • iprim = prim-th root of 1, index form;
  • pad = Padding bytes in shortened block;
  • gfpoly
.

◆ init_rs_char()

QRcode::init_rs_char ( $symsize,
$gfpoly,
$fcr,
$prim,
$nroots,
$pad )
protected

Initialize a Reed-Solomon codec and returns an array of values.

Parameters
int$symsizesymbol size, bits
int$gfpolyField generator polynomial coefficients
int$fcrfirst root of RS code generator polynomial, index form
int$primprimitive element to generate polynomial roots
int$nrootsRS code generator polynomial degree (number of roots)
int$padpadding bytes at front of shortened block
Return values
arrayArray of RS values:
  • mm = Bits per symbol;
  • nn = Symbols per block;
  • alpha_to = log lookup table array;
  • index_of = Antilog lookup table array;
  • genpoly = Generator polynomial array;
  • nroots = Number of generator;
  • roots = number of parity symbols;
  • fcr = First consecutive root, index form;
  • prim = Primitive element, index form;
  • iprim = prim-th root of 1, index form;
  • pad = Padding bytes in shortened block;
  • gfpoly
.

◆ insertStructuredAppendHeader()

QRcode::insertStructuredAppendHeader ( $items,
$size,
$index,
$parity )
protected

insertStructuredAppendHeader

Parameters
array$items
int$size
int$index
int$parity
Return values
arrayitems

◆ isalnumat()

QRcode::isalnumat ( $str,
$pos )
protected

Return true if the character at specified position is an alphanumeric character.

Parameters
string$strstring
int$poscharacted position
Return values
booleantrue of false

◆ isdigitat()

QRcode::isdigitat ( $str,
$pos )
protected

Return true if the character at specified position is a number.

Parameters
string$strstring
int$poscharacted position
Return values
booleantrue of false

◆ lengthIndicator()

QRcode::lengthIndicator ( $mode,
$version )
protected

Return the size of length indicator for the mode and version.

Parameters
int$modeencoding mode
int$versionversion
Return values
intthe size of the appropriate length indicator (bits).

◆ lengthOfCode()

QRcode::lengthOfCode ( $mode,
$version,
$bits )
protected

lengthOfCode

Parameters
int$mode
int$version
int$bits
Return values
intsize

◆ lookAnTable()

QRcode::lookAnTable ( $c)
protected

Look up the alphabet-numeric conversion table (see JIS X0510:2004, pp.19).

Parameters
int$ccharacter value
Return values
intvalue

◆ makeMask()

QRcode::makeMask ( $width,
$frame,
$maskNo,
$level )
protected

makeMask

Parameters
int$width
array$frame
int$maskNo
int$level
Return values
arraymask

◆ makeMaskNo()

QRcode::makeMaskNo ( $maskNo,
$width,
$s,
& $d,
$maskGenOnly = false )
protected

makeMaskNo

Parameters
int$maskNo
int$width
int$s
int$d
boolean$maskGenOnly
Return values
intb

◆ mask()

QRcode::mask ( $width,
$frame,
$level )
protected

mask

Parameters
int$width
array$frame
int$level
Return values
arraybest mask

◆ mask0()

QRcode::mask0 ( $x,
$y )
protected

mask0

Parameters
int$xX position
int$yY position
Return values
intmask

◆ mask1()

QRcode::mask1 ( $x,
$y )
protected

mask1

Parameters
int$xX position
int$yY position
Return values
intmask

◆ mask2()

QRcode::mask2 ( $x,
$y )
protected

mask2

Parameters
int$xX position
int$yY position
Return values
intmask

◆ mask3()

QRcode::mask3 ( $x,
$y )
protected

mask3

Parameters
int$xX position
int$yY position
Return values
intmask

◆ mask4()

QRcode::mask4 ( $x,
$y )
protected

mask4

Parameters
int$xX position
int$yY position
Return values
intmask

◆ mask5()

QRcode::mask5 ( $x,
$y )
protected

mask5

Parameters
int$xX position
int$yY position
Return values
intmask

◆ mask6()

QRcode::mask6 ( $x,
$y )
protected

mask6

Parameters
int$xX position
int$yY position
Return values
intmask

◆ mask7()

QRcode::mask7 ( $x,
$y )
protected

mask7

Parameters
int$xX position
int$yY position
Return values
intmask

◆ maximumWords()

QRcode::maximumWords ( $mode,
$version )
protected

Return the maximum length for the mode and version.

Parameters
int$modeencoding mode
int$versionversion
Return values
intthe maximum length (bytes)

◆ mergeBitStream()

QRcode::mergeBitStream ( $items)
protected

mergeBitStream

Parameters
array$itemsitems
Return values
arraybitstream

◆ modnn()

QRcode::modnn ( $rs,
$x )
protected

modnn

Parameters
array$rsRS values
int$xX position
Return values
intX osition

◆ newFrame()

QRcode::newFrame ( $version)
protected

Set new frame for the specified version.

Parameters
int$versionversion
Return values
arrayarray of unsigned char.

◆ newFromBytes()

QRcode::newFromBytes ( $size,
$data )
protected

Return new bitstream from bytes.

Parameters
int$sizesize
array$databytes
Return values
arraybitstream

◆ newFromNum()

QRcode::newFromNum ( $bits,
$num )
protected

Return new bitstream from number.

Parameters
int$bitsnumber of bits
int$numnumber
Return values
arraybitstream

◆ newInputItem()

QRcode::newInputItem ( $mode,
$size,
$data,
$bstream = null )
protected

newInputItem

Parameters
int$mode
int$size
array$data
array$bstream
Return values
arrayinput item

◆ putAlignmentMarker()

QRcode::putAlignmentMarker ( $frame,
$ox,
$oy )
protected

Put an alignment marker.

Parameters
array$frameframe
int$oxX center coordinate of the pattern
int$oyY center coordinate of the pattern
Return values
arrayframe

◆ putAlignmentPattern()

QRcode::putAlignmentPattern ( $version,
$frame,
$width )
protected

Put an alignment pattern.

Parameters
int$versionversion
array$frameframe
int$widthwidth
Return values
arrayframe

◆ putFinderPattern()

QRcode::putFinderPattern ( $frame,
$ox,
$oy )
protected

Put a finder pattern.

Parameters
array$frameframe
int$oxX center coordinate of the pattern
int$oyY center coordinate of the pattern
Return values
arrayframe

◆ qrstrset()

QRcode::qrstrset ( $srctab,
$x,
$y,
$repl,
$replLen = false )
protected

Replace a value on the array at the specified position.

Parameters
array$srctab
int$xX position
int$yY position
string$replvalue to replace
int$replLenlength of the repl string
Return values
arraysrctab

◆ rsBlockNum()

QRcode::rsBlockNum ( $spec)
protected

Return block number 0.

Parameters
array$spec
Return values
intvalue

◆ rsBlockNum1()

QRcode::rsBlockNum1 ( $spec)
protected

Return block number 1.

Parameters
array$spec
Return values
intvalue

◆ rsBlockNum2()

QRcode::rsBlockNum2 ( $spec)
protected

Return block number 2.

Parameters
array$spec
Return values
intvalue

◆ rsDataCodes1()

QRcode::rsDataCodes1 ( $spec)
protected

Return data codes 1.

Parameters
array$spec
Return values
intvalue

◆ rsDataCodes2()

QRcode::rsDataCodes2 ( $spec)
protected

Return data codes 2.

Parameters
array$spec
Return values
intvalue

◆ rsDataLength()

QRcode::rsDataLength ( $spec)
protected

Return data length.

Parameters
array$spec
Return values
intvalue

◆ rsEccCodes1()

QRcode::rsEccCodes1 ( $spec)
protected

Return ecc codes 1.

Parameters
array$spec
Return values
intvalue

◆ rsEccCodes2()

QRcode::rsEccCodes2 ( $spec)
protected

Return ecc codes 2.

Parameters
array$spec
Return values
intvalue

◆ rsEccLength()

QRcode::rsEccLength ( $spec)
protected

Return ecc length.

Parameters
array$spec
Return values
intvalue

◆ setFrameAt()

QRcode::setFrameAt ( $at,
$val )
protected

Set frame value at specified position.

Parameters
array$atx,y position
int$valvalue of the character to set

◆ splitString()

QRcode::splitString ( )
protected

splitString

Return values
int

◆ writeFormatInformation()

QRcode::writeFormatInformation ( $width,
& $frame,
$mask,
$level )
protected

Write Format Information on frame and returns the number of black bits.

Parameters
int$widthframe width
array$frameframe
array$maskmasking mode
int$levelerror correction level
Return values
intblacks

Member Data Documentation

◆ $alignmentPattern

QRcode::$alignmentPattern
protected
Initial value:
= array(
array( 0, 0),
array( 0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0),
array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50),
array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48),
array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62),
array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58),
array(30, 58), array(34, 62), array(26, 50), array(30, 54), array(26, 52),
array(30, 56), array(34, 60), array(30, 58), array(34, 62), array(30, 54),
array(24, 50), array(28, 54), array(32, 58), array(26, 54), array(30, 58)
)

Array Positions of alignment patterns.

This array includes only the second and the third position of the alignment patterns. Rest of them can be calculated from the distance between them. See Table 1 in Appendix E (pp.71) of JIS X0510:2004.

◆ $anTable

QRcode::$anTable
protected
Initial value:
= array(
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1,
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
)

Alphabet-numeric convesion table.

◆ $capacity

QRcode::$capacity
protected

Array Table of the capacity of symbols.

See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004.

◆ $eccTable

QRcode::$eccTable
protected

Array Table of the error correction code (Reed-Solomon block).

See Table 12-16 (pp.30-36), JIS X0510:2004.

◆ $formatInfo

QRcode::$formatInfo
protected
Initial value:
= array(
array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976),
array(0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0),
array(0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed),
array(0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b)
)

Array Format information.

◆ $lengthTableBits

QRcode::$lengthTableBits
protected
Initial value:
= array(
array(10, 12, 14),
array( 9, 11, 13),
array( 8, 16, 16),
array( 8, 10, 12)
)

Array Length indicator.

◆ $level

QRcode::$level = QR_ECLEVEL_L
protected

Levels of error correction.

See definitions for possible values.

◆ $version

QRcode::$version = 0
protected

QR code version.

Size of QRcode is defined as version. Version is from 1 to 40. Version 1 is 21*21 matrix. And 4 modules increases whenever 1 version increases. So version 40 is 177*177 matrix.

◆ $versionPattern

QRcode::$versionPattern
protected
Initial value:
= array(
0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9,
0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75,
0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64,
0x27541, 0x28c69
)

Array Version information pattern (BCH coded).

See Table 1 in Appendix D (pp.68) of JIS X0510:2004. size: [QRSPEC_VERSION_MAX - 6]


The documentation for this class was generated from the following file: