Table of contents
Namespace: Com\Tecnick\Barcode\Type\Square\QrCode
class Encode extends Compaction
Extends: Compaction
Source: src/Type/Square/QrCode/Encode.php:38
Symbol builder for the QrCode Barcode type class, sections 7.5 to 7.10 of ISO/IEC 18004.
Constants
MASKS
Number of data mask patterns, Table 10 of ISO/IEC 18004.
public const MASKS = 8
Source: src/Type/Square/QrCode/Encode.php:45
MAX_CHARACTERS
Highest number of characters any version and mode can carry, which is the numeric capacity of the version 40 at the error correction level L.
public const MAX_CHARACTERS = 7089
Source: src/Type/Square/QrCode/Encode.php:53
Methods
__construct()
Build the symbol.
public __construct(
string $code,
int $level,
int $version,
bool $kanji,
int $randomMask = -1,
bool $bestMask = true,
int $defaultMask = 2
)
Parameters:
$code(string): Code to encode.$level(int): Error correction level, from 0 to 3.$version(int): Requested version, from 1 to 40, or 0 for the smallest version that carries the code.$kanji(bool): Whether the kanji mode may be used.$randomMask(int): Number of randomly chosen masks to evaluate, or a negative value to evaluate every mask.$bestMask(bool): Whether to evaluate the masks at all.$defaultMask(int): Mask applied when the masks are not evaluated.
Throws:
- Exception: in case of error
Random\RandomException: in case of random generation error
Source: src/Type/Square/QrCode/Encode.php:131
getDataCodewords()
Returns the number of data codewords of a version and error correction level: the codeword capacity of the version less the error correction codewords of Table 9 of ISO/IEC 18004.
public static getDataCodewords(int $version, int $level): int
Parameters:
$version(int): Symbol version.$level(int): Error correction level.
Returns: int
Source: src/Type/Square/QrCode/Encode.php:181
getEncodingModules()
Returns the number of modules of the encoding region of a version, that is every module the function patterns, the format information and the version information do not take.
public static getEncodingModules(int $version): int
Parameters:
$version(int): Symbol version.
Returns: int
Source: src/Type/Square/QrCode/Encode.php:217
getGrid()
Returns the module matrix as an array of rows of binary digits.
public getGrid(): array<int,string>
Returns: array<int,string>
Source: src/Type/Square/QrCode/Encode.php:155
getRemainderBits()
Returns the number of remainder bits of a version, that is the modules of the encoding region left over by the last codeword.
public static getRemainderBits(int $version): int
Parameters:
$version(int): Symbol version.
Returns: int
Source: src/Type/Square/QrCode/Encode.php:205
getTotalCodewords()
Returns the codeword capacity of a version, that is the number of modules of the encoding region divided by eight, section 7.4.10 of ISO/IEC 18004.
public static getTotalCodewords(int $version): int
Parameters:
$version(int): Symbol version.
Returns: int
Source: src/Type/Square/QrCode/Encode.php:194
getVersion()
Returns the symbol version, from 1 to 40.
public getVersion(): int
Returns: int