\BarcodeBakery\BarcodeBCGgs1128

Summary

Methods
Properties
Constants
__construct()
setStart()
getTilde()
setTilde()
parse()
draw()
getDimension()
getThickness()
setThickness()
getLabel()
setLabel()
getFont()
setFont()
getChecksum()
setDisplayChecksum()
getForegroundColor()
setForegroundColor()
getBackgroundColor()
setBackgroundColor()
setColor()
getScale()
setScale()
getOffsetX()
setOffsetX()
getOffsetY()
setOffsetY()
addLabel()
removeLabel()
getLabels()
clearLabels()
getAiContentChecksum()
setStrictMode()
getStrictMode()
setAllowsUnknownIdentifier()
getAllowsUnknownIdentifier()
setNoLengthLimit()
getNoLengthLimit()
No public properties found
CODE128_A
CODE128_B
CODE128_C
KEYA_FNC3
KEYA_FNC2
KEYA_SHIFT
KEYA_CODEC
KEYA_CODEB
KEYA_FNC4
KEYA_FNC1
KEYB_FNC3
KEYB_FNC2
KEYB_SHIFT
KEYB_CODEC
KEYB_FNC4
KEYB_CODEA
KEYB_FNC1
KEYC_CODEB
KEYC_CODEA
KEYC_FNC1
KEY_STARTA
KEY_STARTB
KEY_STARTC
KEY_STOP
SIZE_SPACING_FONT
AUTO_LABEL
COLOR_BG
COLOR_FG
KIND_OF_DATA
MINLENGTH
MAXLENGTH
CHECKSUM
NUMERIC
ALPHA_NUMERIC
DATE_YYMMDD
ID
CONTENT
MAX_ID_FORMATED
MAX_ID_NOT_FORMATED
MAX_GS1128_CHARS
validate()
calculateChecksum()
processChecksum()
addDefaultLabel()
findIndex()
findCode()
drawChar()
drawSingleBar()
nextX()
drawText()
drawPixel()
drawRectangle()
drawFilledRectangle()
getColor()
$keysA
$keysB
$keysC
$thickness
$keys
$code
$positionX
$font
$text
$checksumValue
$displayChecksum
$label
$defaultLabel
$colorFg
$colorBg
$scale
$offsetX
$offsetY
$labels
$pushLabel
N/A
setStartFromText()
extractTilde()
getSequenceParsed()
setParseA()
setParseB()
setParseC()
getSequence()
createBinaryStream()
encodeChar()
setData()
getBiggestLabels()
formatGs1128()
parseGs1128()
parseContent()
idExists()
findIdFormated()
findIdNotFormated()
checkConformity()
checkChecksum()
checkVars()
calculateChecksumMod10()
$starting_text
$indcheck
$data
$lastTable
$tilde
$shift
$latch
$fnc
$METHOD
$strictMode
$allowsUnknownIdentifier
$noLengthLimit
$identifiersId
$identifiersContent
$identifiersAi
N/A

Constants

CODE128_A

CODE128_A = 1

CODE128_B

CODE128_B = 2

CODE128_C

CODE128_C = 3

KEYA_FNC3

KEYA_FNC3 = 96

KEYA_FNC2

KEYA_FNC2 = 97

KEYA_SHIFT

KEYA_SHIFT = 98

KEYA_CODEC

KEYA_CODEC = 99

KEYA_CODEB

KEYA_CODEB = 100

KEYA_FNC4

KEYA_FNC4 = 101

KEYA_FNC1

KEYA_FNC1 = 102

KEYB_FNC3

KEYB_FNC3 = 96

KEYB_FNC2

KEYB_FNC2 = 97

KEYB_SHIFT

KEYB_SHIFT = 98

KEYB_CODEC

KEYB_CODEC = 99

KEYB_FNC4

KEYB_FNC4 = 100

KEYB_CODEA

KEYB_CODEA = 101

KEYB_FNC1

KEYB_FNC1 = 102

KEYC_CODEB

KEYC_CODEB = 100

KEYC_CODEA

KEYC_CODEA = 101

KEYC_FNC1

KEYC_FNC1 = 102

KEY_STARTA

KEY_STARTA = 103

KEY_STARTB

KEY_STARTB = 104

KEY_STARTC

KEY_STARTC = 105

KEY_STOP

KEY_STOP = 106

SIZE_SPACING_FONT

SIZE_SPACING_FONT = 5

AUTO_LABEL

AUTO_LABEL = '##!!AUTO_LABEL!!##'

COLOR_BG

COLOR_BG = 0

COLOR_FG

COLOR_FG = 1

KIND_OF_DATA

KIND_OF_DATA = 0

MINLENGTH

MINLENGTH = 1

MAXLENGTH

MAXLENGTH = 2

CHECKSUM

CHECKSUM = 3

NUMERIC

NUMERIC = 0

ALPHA_NUMERIC

ALPHA_NUMERIC = 1

DATE_YYMMDD

DATE_YYMMDD = 2

ID

ID = 0

CONTENT

CONTENT = 1

MAX_ID_FORMATED

MAX_ID_FORMATED = 6

MAX_ID_NOT_FORMATED

MAX_ID_NOT_FORMATED = 4

MAX_GS1128_CHARS

MAX_GS1128_CHARS = 48

Properties

$keysA

$keysA

$keysB

$keysB

$keysC

$keysC

$thickness

$thickness

$keys

$keys

$code

$code

$positionX

$positionX

$font

$font

$text

$text

$checksumValue

$checksumValue

$displayChecksum

$displayChecksum

$label

$label

$defaultLabel

$defaultLabel

$colorFg

$colorFg

$colorBg

$colorBg

$scale

$scale

$offsetX

$offsetX

$offsetY

$offsetY

$labels

$labels

$pushLabel

$pushLabel

$starting_text

$starting_text

$indcheck

$indcheck

$data

$data

$lastTable

$lastTable

$tilde

$tilde

$shift

$shift

$latch

$latch

$fnc

$fnc

$METHOD

$METHOD

$strictMode

$strictMode

$allowsUnknownIdentifier

$allowsUnknownIdentifier

$noLengthLimit

$noLengthLimit

$identifiersId

$identifiersId

$identifiersContent

$identifiersContent

$identifiersAi

$identifiersAi

Methods

__construct()

__construct(\BarcodeBakery\Barcode\char  $start = null) : mixed

Constructors

Parameters

\BarcodeBakery\Barcode\char $start

Returns

mixed —

setStart()

setStart(string  $table) : mixed

Specifies the start code. Can be 'A', 'B', 'C', or null - Table A: Capitals + ASCII 0-31 + punct - Table B: Capitals + LowerCase + punct - Table C: Numbers

If null is specified, the table selection is automatically made. The default is null.

Parameters

string $table

Returns

mixed —

getTilde()

getTilde() : bool

Gets the tilde.

Returns

bool —

setTilde()

setTilde(bool  $accept) : mixed

Accepts tilde to be process as a special character.

If true, you can do this:

  • ~~ : to make ONE tilde
  • ~Fx : to insert FCNx. x is equal from 1 to 4.

Parameters

bool $accept

Returns

mixed —

parse()

parse(string  $text) : mixed

Parses Text.

Parameters

string $text

Returns

mixed —

draw()

draw(resource  $im) : mixed

Abstract method that draws the barcode on the resource.

Parameters

resource $im

Returns

mixed —

getDimension()

getDimension(int  $w, int  $h) : int[]

Returns the maximal size of a barcode.

[0]->width [1]->height

Parameters

int $w
int $h

Returns

int[] —

getThickness()

getThickness() : int

Gets the thickness.

Returns

int —

setThickness()

setThickness(int  $thickness) : mixed

Sets the thickness.

Parameters

int $thickness

Returns

mixed —

getLabel()

getLabel() : string

Gets the label.

If the label was set to BCGBarcode1D::AUTO_LABEL, the label will display the value from the text parsed.

Returns

string —

setLabel()

setLabel(string  $label) : mixed

Sets the label.

You can use BCGBarcode::AUTO_LABEL to have the label automatically written based on the parsed text.

Parameters

string $label

Returns

mixed —

getFont()

getFont() : \BarcodeBakery\Common\BCGFont

Gets the font.

Returns

\BarcodeBakery\Common\BCGFont —

setFont()

setFont(mixed  $font) : mixed

Sets the font.

Parameters

mixed $font

BCGFont or int

Returns

mixed —

getChecksum()

getChecksum() : string

Gets the checksum of a Barcode.

If no checksum is available, return FALSE.

Returns

string —

setDisplayChecksum()

setDisplayChecksum(bool  $displayChecksum) : mixed

Sets if the checksum is displayed with the label or not.

The checksum must be activated in some case to make this variable effective.

Parameters

bool $displayChecksum

Returns

mixed —

getForegroundColor()

getForegroundColor() : \BarcodeBakery\Common\BCGColor

Gets the foreground color of the barcode.

Returns

\BarcodeBakery\Common\BCGColor —

setForegroundColor()

setForegroundColor(mixed  $code) : mixed

Sets the foreground color of the barcode. It could be a BCGColor value or simply a language code (white, black, yellow...) or hex value.

Parameters

mixed $code

Returns

mixed —

getBackgroundColor()

getBackgroundColor() : \BarcodeBakery\Common\BCGColor

Gets the background color of the barcode.

Returns

\BarcodeBakery\Common\BCGColor —

setBackgroundColor()

setBackgroundColor(mixed  $code) : mixed

Sets the background color of the barcode. It could be a BCGColor value or simply a language code (white, black, yellow...) or hex value.

Parameters

mixed $code

Returns

mixed —

setColor()

setColor(mixed  $fg, mixed  $bg) : mixed

Sets the color.

Parameters

mixed $fg
mixed $bg

Returns

mixed —

getScale()

getScale() : int

Gets the scale of the barcode.

Returns

int —

setScale()

setScale(int  $scale) : mixed

Sets the scale of the barcode in pixel.

If the scale is lower than 1, an exception is raised.

Parameters

int $scale

Returns

mixed —

getOffsetX()

getOffsetX() : int

Gets the X offset.

Returns

int —

setOffsetX()

setOffsetX(int  $offsetX) : mixed

Sets the X offset.

Parameters

int $offsetX

Returns

mixed —

getOffsetY()

getOffsetY() : int

Gets the Y offset.

Returns

int —

setOffsetY()

setOffsetY(int  $offsetY) : mixed

Sets the Y offset.

Parameters

int $offsetY

Returns

mixed —

addLabel()

addLabel(\BarcodeBakery\Common\BCGLabel  $label) : mixed

Adds the label to the drawing.

Parameters

\BarcodeBakery\Common\BCGLabel $label

Returns

mixed —

removeLabel()

removeLabel(\BarcodeBakery\Common\BCGLabel  $label) : mixed

Removes the label from the drawing.

Parameters

\BarcodeBakery\Common\BCGLabel $label

Returns

mixed —

getLabels()

getLabels() : \BarcodeBakery\Common\BCGLabel[]

Gets the labels.

Returns

\BarcodeBakery\Common\BCGLabel[] —

clearLabels()

clearLabels() : mixed

Clears the labels.

Returns

mixed —

getAiContentChecksum()

getAiContentChecksum(string  $content) : int

Gets the content checksum for an identifier.

Do not pass the identifier code.

Parameters

string $content

Returns

int —

setStrictMode()

setStrictMode(bool  $strictMode) : mixed

Enables or disables the strict mode.

Parameters

bool $strictMode

Returns

mixed —

getStrictMode()

getStrictMode() : bool

Gets if the strict mode is activated.

Returns

bool —

setAllowsUnknownIdentifier()

setAllowsUnknownIdentifier(bool  $allow) : mixed

Allows unknown identifiers.

Parameters

bool $allow

Returns

mixed —

getAllowsUnknownIdentifier()

getAllowsUnknownIdentifier() : bool

Gets if unkmown identifiers are allowed.

Returns

bool —

setNoLengthLimit()

setNoLengthLimit(bool  $noLengthLimit) : mixed

Removes the limit of 48 characters.

Parameters

bool $noLengthLimit

Returns

mixed —

getNoLengthLimit()

getNoLengthLimit() : bool

Gets if the limit of 48 characters is removed.

Returns

bool —

validate()

validate() : mixed

Validates the input

Returns

mixed —

calculateChecksum()

calculateChecksum() : mixed

Method that saves FALSE into the checksumValue. This means no checksum but this method should be overriden when needed.

Returns

mixed —

processChecksum()

processChecksum() : string

Returns FALSE because there is no checksum. This method should be overriden to return correctly the checksum in string with checksumValue.

Returns

string —

addDefaultLabel()

addDefaultLabel() : mixed

Adds the default label.

Returns

mixed —

findIndex()

findIndex(mixed  $var) : mixed

Returns the index in $keys (useful for checksum).

Parameters

mixed $var

Returns

mixed —

findCode()

findCode(mixed  $var) : string

Returns the code of the char (useful for drawing bars).

Parameters

mixed $var

Returns

string —

drawChar()

drawChar(resource  $im, string  $code, bool  $startBar = true) : mixed

Draws all chars thanks to $code. If $startBar is true, the line begins by a space.

If $startBar is false, the line begins by a bar.

Parameters

resource $im
string $code
bool $startBar

Returns

mixed —

drawSingleBar()

drawSingleBar(mixed  $im, int  $color) : mixed

Draws a Bar of $color depending of the resolution.

Parameters

mixed $im
int $color

Returns

mixed —

nextX()

nextX() : mixed

Moving the pointer right to write a bar.

Returns

mixed —

drawText()

drawText(resource  $im, int  $x1, int  $y1, int  $x2, int  $y2) : mixed

Draws the text.

The coordinate passed are the positions of the barcode. $x1 and $y1 represent the top left corner. $x2 and $y2 represent the bottom right corner.

Parameters

resource $im
int $x1
int $y1
int $x2
int $y2

Returns

mixed —

drawPixel()

drawPixel(resource  $im, int  $x, int  $y, int  $color = self::COLOR_FG) : mixed

Draws 1 pixel on the resource at a specific position with a determined color.

Parameters

resource $im
int $x
int $y
int $color

Returns

mixed —

drawRectangle()

drawRectangle(resource  $im, int  $x1, int  $y1, int  $x2, int  $y2, int  $color = self::COLOR_FG) : mixed

Draws an empty rectangle on the resource at a specific position with a determined color.

Parameters

resource $im
int $x1
int $y1
int $x2
int $y2
int $color

Returns

mixed —

drawFilledRectangle()

drawFilledRectangle(resource  $im, int  $x1, int  $y1, int  $x2, int  $y2, int  $color = self::COLOR_FG) : mixed

Draws a filled rectangle on the resource at a specific position with a determined color.

Parameters

resource $im
int $x1
int $y1
int $x2
int $y2
int $color

Returns

mixed —

getColor()

getColor(resource  $im, int  $color) : resource

Allocates the color based on the integer.

Parameters

resource $im
int $color

Returns

resource —

setStartFromText()

setStartFromText(string  $text) : mixed

Specifies the starting_text table if none has been specified earlier.

Parameters

string $text

Returns

mixed —

extractTilde()

extractTilde(string  $text, int  $pos) : string

Extracts the ~ value from the $text at the $pos.

If the tilde is not ~~, ~F1, ~F2, ~F3, ~F4; an error is raised.

Parameters

string $text
int $pos

Returns

string —

getSequenceParsed()

getSequenceParsed(string  $text, string  $currentMode) : string

Gets the "dotted" sequence for the $text based on the $currentMode.

There is also a check if we use the special tilde ~

Parameters

string $text
string $currentMode

Returns

string —

setParseA()

setParseA(string  $text, string  $currentMode) : string

Parses the text and returns the appropriate sequence for the Table A.

Parameters

string $text
string $currentMode

Returns

string —

setParseB()

setParseB(string  $text, string  $currentMode) : string

Parses the text and returns the appropriate sequence for the Table B.

Parameters

string $text
string $currentMode

Returns

string —

setParseC()

setParseC(string  $text, string  $currentMode) : string

Parses the text and returns the appropriate sequence for the Table C.

Parameters

string $text
string $currentMode

Returns

string —

getSequence()

getSequence(string  $text, string  $starting_text) : string

Depending on the $text, it will return the correct sequence to encode the text.

Parameters

string $text
string $starting_text

Returns

string —

createBinaryStream()

createBinaryStream(string  $text, string  $seq) : string[][]

Depending on the sequence $seq given (returned from getSequence()), this method will return the code stream in an array. Each char will be a string of bit based on the Code 128.

Each letter from the sequence represents bits.

0 to 2 are latches A to B are Shift + Letter . is a char in the current encoding

Parameters

string $text
string $seq

Returns

string[][] —

encodeChar()

encodeChar(int[]  $data, int  $encoding, string  $seq, string  $text, int  $i, int  $counter, int[]  $indcheck) : mixed

Encodes characters, base on its encoding and sequence

Parameters

int[] $data
int $encoding
string $seq
string $text
int $i
int $counter
int[] $indcheck

Returns

mixed —

setData()

setData(array  $data) : mixed

Saves data into the classes.

This method will save data, calculate real column number (if -1 was selected), the real error level (if -1 was selected)... It will add Padding to the end and generate the error codes.

Parameters

array $data

Returns

mixed —

getBiggestLabels()

getBiggestLabels(bool  $reversed = false) : \BarcodeBakery\Common\BCGLabel[]

Returning the biggest label widths for LEFT/RIGHT and heights for TOP/BOTTOM.

Parameters

bool $reversed

Returns

\BarcodeBakery\Common\BCGLabel[] —

formatGs1128()

formatGs1128() : string

Formats data for gs1-128.

Returns

string —

parseGs1128()

parseGs1128(mixed  $text) : mixed

Parses the text to gs1-128.

Parameters

mixed $text

Returns

mixed —

parseContent()

parseContent(string  $text) : bool

Splits the id and the content for each application identifiers (AIs).

Parameters

string $text

Returns

bool —

idExists()

idExists(string  $id, bool  $yAlreadySet, string  $realNameId) : bool

Checks if an id exists.

Parameters

string $id
bool $yAlreadySet
string $realNameId

Returns

bool —

findIdFormated()

findIdFormated(string  $id, bool  $yAlreadySet, string  $realNameId) : mixed

Finds ID with formated content.

Parameters

string $id
bool $yAlreadySet
string $realNameId

Returns

mixed —

findIdNotFormated()

findIdNotFormated(string  $id, bool  $yAlreadySet, string  $realNameId) : mixed

Finds ID with non-formated content.

Parameters

string $id
bool $yAlreadySet
string $realNameId

Returns

mixed —

checkConformity()

checkConformity(string  $content, string  $id, string  $realNameId) : bool

Checks confirmity of the content.

Parameters

string $content
string $id
string $realNameId

Returns

bool —

checkChecksum()

checkChecksum(string  $content, string  $id, int  $realNameId, int  $checksumAdded) : bool

Verifies the checksum.

Parameters

string $content
string $id
int $realNameId
int $checksumAdded

Returns

bool —

checkVars()

checkVars(string  $content, string  $id, bool  $yAlreadySet, int  $decimalPointRemoved) : bool

Checks vars "y".

Parameters

string $content
string $id
bool $yAlreadySet
int $decimalPointRemoved

Returns

bool —

calculateChecksumMod10()

calculateChecksumMod10(int  $content) : int

Checksum Mod10.

Parameters

int $content

Returns

int —