classes-Com-Tecnick-Barcode-Type-Square-QrCode

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

QrCode extends Square

Com\Tecnick\Barcode\Type\Square\QrCode

QrCode Barcode type class

Tags
since
2015-02-21
category

Library

author

Nicola Asuni info@tecnick.com

copyright

2015-2016 Nicola Asuni - Tecnick.com LTD

license

http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)

link
https://github.com/tecnickcom/tc-lib-barcode

Table of Contents

$bars  : array<string|int, mixed>
Array containing the position and dimensions of each barcode bar (x, y, width, height)
$best_mask  : bool
If true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
$bg_color_obj  : Color
Backgorund Color object
$bsObj  : ByteStream
ByteStream class object
$case_sensitive  : bool
Boolean flag, if false the input string will be converted to uppercase.
$code  : string
Code to convert (barcode content)
$color_obj  : Color
Foreground Color object
$default_mask  : int
Default mask used when $this->best_mask === false
$extcode  : string
Resulting code after applying checksum etc.
$format  : string
Barcode format
$height  : float
Barcode height
$height_ratio  : float
Ratio between the barcode height and the number of columns
$hint  : int
Encoding mode
$level  : int
Error correction level
$ncols  : int
Total number of columns
$nrows  : int
Total number of rows
$padding  : array<string|int, mixed>
Additional padding to add around the barcode (top, right, bottom, left) in user units.
$params  : array<string|int, mixed>
Array containing extra parameters for the specified barcode type
$random_mask  : int
If false, checks all masks available, otherwise the value indicates the number of masks to be checked, mask id are random
$type  : string
Barcode type (linear or square)
$version  : int
QR code version.
$width  : float
Barcode width
$width_ratio  : float
Ratio between the barcode width and the number of rows
__construct()  : mixed
Initialize a new barcode object
getArray()  : array<string|int, mixed>
Get the barcode raw array
getBarsArray()  : array<string|int, mixed>
Get the array containing all the formatted bars coordinates
getExtendedCode()  : string
Get the extended code (code + checksum)
getGd()  : object
Get the barcode as GD image object (requires GD library)
getGrid()  : string
Get a raw barcode string representation using characters
getGridArray()  : array<string|int, mixed>
Get a raw barcode grid array
getHtmlDiv()  : string
Get an HTML representation of the barcode.
getPng()  : mixed
Get Barcode as PNG Image (requires GD or Imagick library)
getPngData()  : string
Get the barcode as PNG image (requires GD or Imagick library)
getPngDataImagick()  : object
Get the barcode as PNG image (requires Imagick library)
getSvg()  : mixed
Get the barcode as SVG image object
getSvgCode()  : string
Get the barcode as SVG code
setBackgroundColor()  : mixed
Set the background color
setColor()  : mixed
Set the color of the bars.
setSize()  : mixed
Set the size of the barcode to be exported
binarize()  : array<string|int, mixed>
Convert the frame in binary form
convertDecToHex()  : string
Convert large integer number to hexadecimal representation.
convertHexToDec()  : string
Convert large hexadecimal number to decimal representation (string).
encodeString()  : mixed
Encode the input string
getBarRectXYWH()  : array<string|int, mixed>
Get the adjusted rectangular coordinates (x,y,w,h) for the specified bar
getBarRectXYXY()  : array<string|int, mixed>
Get the adjusted rectangular coordinates (x1,y1,x2,y2) for the specified bar
getRgbColorObject()  : Color
Get the RGB Color object for the given color representation
getRotatedBarArray()  : array<string|int, mixed>
Returns the bars array ordered by columns
processBinarySequence()  : mixed
Import a binary sequence of comma-separated 01 strings
setBars()  : mixed
Get the bars array
setPadding()  : mixed
Set the barcode padding
setParameters()  : mixed
Set extra (optional) parameters: 1: LEVEL - error correction level: L, M, Q, H 2: HINT - encoding mode: NL=variable, NM=numeric, AN=alphanumeric, 8B=8bit, KJ=KANJI, ST=STRUCTURED 3: VERSION - integer value from 1 to 40 4: CASE SENSITIVE - if 0 the input string will be converted to uppercase 5: RANDOM MASK - false or number of masks to be checked 6: BEST MASK - true to find the best mask (slow) 7: DEFAULT MASK - mask to use when the best mask option is false
toUpper()  : mixed
Convert input string into upper case mode

Properties

$bars

Array containing the position and dimensions of each barcode bar (x, y, width, height)

protected array<string|int, mixed> $bars = array()

$best_mask

If true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code

protected bool $best_mask = true

$bg_color_obj

Backgorund Color object

protected Color $bg_color_obj

$case_sensitive

Boolean flag, if false the input string will be converted to uppercase.

protected bool $case_sensitive = true

$code

Code to convert (barcode content)

protected string $code = ''

$color_obj

Foreground Color object

protected Color $color_obj

$default_mask

Default mask used when $this->best_mask === false

protected int $default_mask = 2

$extcode

Resulting code after applying checksum etc.

protected string $extcode = ''

$format

Barcode format

protected string $format = 'QRCODE'

$height

Barcode height

protected float $height

$height_ratio

Ratio between the barcode height and the number of columns

protected float $height_ratio

$hint

Encoding mode

protected int $hint = 2

$level

Error correction level

protected int $level = 0

$ncols

Total number of columns

protected int $ncols = 0

$nrows

Total number of rows

protected int $nrows = 1

$padding

Additional padding to add around the barcode (top, right, bottom, left) in user units.

protected array<string|int, mixed> $padding = array('T' => 0, 'R' => 0, 'B' => 0, 'L' => 0)

A negative value indicates the multiplication factor for each row or column.

$params

Array containing extra parameters for the specified barcode type

protected array<string|int, mixed> $params

$random_mask

If false, checks all masks available, otherwise the value indicates the number of masks to be checked, mask id are random

protected int $random_mask = false

$type

Barcode type (linear or square)

protected string $type = ''

$version

QR code version.

protected int $version = 0

The Size of QRcode is defined as version. Version is an integer value from 1 to 40. Version 1 is 2121 matrix. And 4 modules increases whenever 1 version increases. So version 40 is 177177 matrix.

$width

Barcode width

protected float $width

$width_ratio

Ratio between the barcode width and the number of rows

protected float $width_ratio

Methods

__construct()

Initialize a new barcode object

public __construct(string $code[, int $width = -1 ][, int $height = -1 ][, string $color = 'black' ][, array<string|int, mixed> $params = array() ][, array<string|int, mixed> $padding = array(0, 0, 0, 0) ]) : mixed
Parameters
$code : string

Barcode content

$width : int = -1

Barcode width in user units (excluding padding). A negative value indicates the multiplication factor for each column.

$height : int = -1

Barcode height in user units (excluding padding). A negative value indicates the multiplication factor for each row.

$color : string = 'black'

Foreground color in Web notation (color name, or hexadecimal code, or CSS syntax)

$params : array<string|int, mixed> = array()

Array containing extra parameters for the specified barcode type

$padding : array<string|int, mixed> = array(0, 0, 0, 0)

Additional padding to add around the barcode (top, right, bottom, left) in user units. A negative value indicates the number or rows or columns.

Tags
throws
Exception

in case of error

throws
Exception

in case of color error

Return values
mixed

getArray()

Get the barcode raw array

public getArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

getBarsArray()

Get the array containing all the formatted bars coordinates

public getBarsArray([string $type = 'XYXY' ]) : array<string|int, mixed>
Parameters
$type : string = 'XYXY'

Type of coordinates to return: 'XYXY' or 'XYWH'

Return values
array<string|int, mixed>

getExtendedCode()

Get the extended code (code + checksum)

public getExtendedCode() : string
Return values
string

getGd()

Get the barcode as GD image object (requires GD library)

public getGd() : object
Tags
throws
Exception

if the GD library is not installed

Return values
object

getGrid()

Get a raw barcode string representation using characters

public getGrid([string $space_char = '0' ][, string $bar_char = '1' ]) : string
Parameters
$space_char : string = '0'

Character or string to use for filling empty spaces

$bar_char : string = '1'

Character or string to use for filling bars

Return values
string

getGridArray()

Get a raw barcode grid array

public getGridArray([string $space_char = '0' ][, string $bar_char = '1' ]) : array<string|int, mixed>
Parameters
$space_char : string = '0'

Character or string to use for filling empty spaces

$bar_char : string = '1'

Character or string to use for filling bars

Return values
array<string|int, mixed>

getHtmlDiv()

Get an HTML representation of the barcode.

public getHtmlDiv() : string
Return values
string

HTML code (DIV block)

getPng()

Get Barcode as PNG Image (requires GD or Imagick library)

public getPng() : mixed
Return values
mixed

getPngData()

Get the barcode as PNG image (requires GD or Imagick library)

public getPngData([bool $imagick = true ]) : string
Parameters
$imagick : bool = true

If true try to use the Imagick extension

Return values
string

PNG image data

getPngDataImagick()

Get the barcode as PNG image (requires Imagick library)

public getPngDataImagick() : object
Tags
throws
Exception

if the Imagick library is not installed

Return values
object

getSvg()

Get the barcode as SVG image object

public getSvg() : mixed
Return values
mixed

getSvgCode()

Get the barcode as SVG code

public getSvgCode() : string
Return values
string

SVG code

setBackgroundColor()

Set the background color

public setBackgroundColor(string $color) : mixed
Parameters
$color : string

Background color in Web notation (color name, or hexadecimal code, or CSS syntax)

Tags
throws
Exception

in case of color error

Return values
mixed

setColor()

Set the color of the bars.

public setColor(string $color) : mixed

If the color is transparent or empty it will be set to the default black color.

Parameters
$color : string

Foreground color in Web notation (color name, or hexadecimal code, or CSS syntax)

Tags
throws
Exception

in case of color error

throws
Exception

in case of empty or transparent color

Return values
mixed

setSize()

Set the size of the barcode to be exported

public setSize(int $width, int $height[, array<string|int, mixed> $padding = array(0, 0, 0, 0) ]) : mixed
Parameters
$width : int

Barcode width in user units (excluding padding). A negative value indicates the multiplication factor for each column.

$height : int

Barcode height in user units (excluding padding). A negative value indicates the multiplication factor for each row.

$padding : array<string|int, mixed> = array(0, 0, 0, 0)

Additional padding to add around the barcode (top, right, bottom, left) in user units. A negative value indicates the number or rows or columns.

Return values
mixed

binarize()

Convert the frame in binary form

protected binarize(array<string|int, mixed> $frame) : array<string|int, mixed>
Parameters
$frame : array<string|int, mixed>

Array to binarize

Return values
array<string|int, mixed>

frame in binary form

convertDecToHex()

Convert large integer number to hexadecimal representation.

protected convertDecToHex(string $number) : string
Parameters
$number : string

Number to convert (as string)

Return values
string

hexadecimal representation

convertHexToDec()

Convert large hexadecimal number to decimal representation (string).

protected convertHexToDec(string $hex) : string
Parameters
$hex : string

Hexadecimal number to convert (as string)

Return values
string

hexadecimal representation

encodeString()

Encode the input string

protected encodeString(string $data) : mixed
Parameters
$data : string

input string to encode

Return values
mixed

getBarRectXYWH()

Get the adjusted rectangular coordinates (x,y,w,h) for the specified bar

protected getBarRectXYWH(mixed $bar) : array<string|int, mixed>
Parameters
$bar : mixed
Return values
array<string|int, mixed>

Bar coordinates

getBarRectXYXY()

Get the adjusted rectangular coordinates (x1,y1,x2,y2) for the specified bar

protected getBarRectXYXY(mixed $bar) : array<string|int, mixed>
Parameters
$bar : mixed
Return values
array<string|int, mixed>

Bar coordinates

getRgbColorObject()

Get the RGB Color object for the given color representation

protected getRgbColorObject(string $color) : Color
Parameters
$color : string

Color in Web notation (color name, or hexadecimal code, or CSS syntax)

Tags
throws
Exception

in case of color error

Return values
Color

object or null

getRotatedBarArray()

Returns the bars array ordered by columns

protected getRotatedBarArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

processBinarySequence()

Import a binary sequence of comma-separated 01 strings

protected processBinarySequence(string $code) : mixed
Parameters
$code : string

Code to process

Return values
mixed

setBars()

Get the bars array

protected setBars() : mixed
Tags
throws
Exception

in case of error

Return values
mixed

setPadding()

Set the barcode padding

protected setPadding(array<string|int, mixed> $padding) : mixed
Parameters
$padding : array<string|int, mixed>

Additional padding to add around the barcode (top, right, bottom, left) in user units. A negative value indicates the number or rows or columns.

Tags
throws
Exception

in case of error

Return values
mixed

setParameters()

Set extra (optional) parameters: 1: LEVEL - error correction level: L, M, Q, H 2: HINT - encoding mode: NL=variable, NM=numeric, AN=alphanumeric, 8B=8bit, KJ=KANJI, ST=STRUCTURED 3: VERSION - integer value from 1 to 40 4: CASE SENSITIVE - if 0 the input string will be converted to uppercase 5: RANDOM MASK - false or number of masks to be checked 6: BEST MASK - true to find the best mask (slow) 7: DEFAULT MASK - mask to use when the best mask option is false

protected setParameters() : mixed
Tags
SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

Return values
mixed

toUpper()

Convert input string into upper case mode

protected toUpper(string $data) : mixed
Parameters
$data : string

Data

Return values
mixed
 

© 2004-2021 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy