GsOneElementString

GS1 Application Identifier element strings (GS1 General Specifications)

Namespace: Com\Tecnick\Barcode\Type

File: GsOneElementString.php line 44

GS1 Application Identifier element strings (GS1 General Specifications)

Reads the bracketed form “(ai)value(ai)value…”, which is also the human readable interpretation, and checks the Application Identifier syntax, the encodable character set 82 and the predefined element string lengths. Parentheses are reserved as Application Identifier delimiters and cannot appear in a value. Element strings whose Application Identifier is not listed in PREDEFINED are of variable length and need an FNC1 separator unless they are last.

Tags

Constants

CSET82

File: GsOneElementString.php line 52

public string CSET82 = '!"%&\'()*+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'

PREDEFINED

File: GsOneElementString.php line 61

public array<int|string, int> PREDEFINED = ['00' => 20, '01' => 16, '02' => 16, '03' => 16, '04' => 18, '11' => 8, '12' => 8, '13' => 8, '14' => 8, '15' => 8, '16' => 8, '17' => 8, '18' => 8, '19' => 8, '20' => 4, '31' => 10, '32' => 10, '33' => 10, '34' => 10, '35' => 10, '36' => 10, '41' => 16]

Methods

getCheckDigit()

File: GsOneElementString.php line 92

public getCheckDigit(string $code) : int

The rightmost data digit has weight 3 and the weights alternate to the left.

Parameters

  • $code : string: Data digits without the check digit

Return values

int

getData()

File: GsOneElementString.php line 236

public getData(array<int, array{string, string}> $elements, string $separator) : string

Parameters

  • $elements : array<int, array{string, string}>: Application Identifier and value pairs
  • $separator : string: Function 1 Symbol Character

Return values

string

getHumanReadable()

File: GsOneElementString.php line 219

public getHumanReadable(array<int, array{string, string}> $elements) : string

Parameters

  • $elements : array<int, array{string, string}>: Application Identifier and value pairs

Return values

string

hasPredefinedLength()

File: GsOneElementString.php line 209

public hasPredefinedLength(string $appid) : bool

Parameters

  • $appid : string: Application Identifier digits, without brackets

Return values

bool

parse()

File: GsOneElementString.php line 112

public parse(string $code) : array<int, array{string, string}>

Parameters

  • $code : string: Bracketed element strings

Tags

  • throws: Exception if the bracketed form is malformed or cannot be encoded

Return values

array<int, array{string, string}>

validate()

File: GsOneElementString.php line 154

public validate(string $appid, string $value) : void

Parameters

  • $appid : string: Application Identifier digits, without brackets
  • $value : string: Data field of the element string

Tags

  • throws: Exception if the element string cannot be encoded