Royalmail
extends AbstractAdapter
in package
Table of Contents
Properties
- $columns : array<string, int>
- $options : array<string|int, mixed>
- Allowed options for this adapter
- $rows : array<string, int>
Methods
- __construct() : mixed
- Constructor for this barcode adapter
- getCharacters() : int|string|array<string|int, mixed>
- Returns the allowed characters
- getChecksum() : string
- Returns the checksum function name
- getLength() : int|array<string|int, mixed>
- Returns the allowed barcode length
- hasValidCharacters() : bool
- Allows start and stop tag within checked chars
- hasValidChecksum() : bool
- Validates the checksum
- hasValidLength() : bool
- Checks the length of a barcode
- useChecksum() : AbstractAdapter|bool
- Sets the checksum validation, if no value is given, the actual setting is returned
- code25() : bool
- Validates the checksum (Modulo 10) CODE25 implementation factor 3
- gtin() : bool
- Validates the checksum (Modulo 10) GTIN implementation factor 3
- identcode() : bool
- Validates the checksum (Modulo 10) IDENTCODE implementation factors 9 and 4
- postnet() : bool
- Validates the checksum () POSTNET implementation
- royalmail() : bool
- Validates the checksum ()
- setCharacters() : $this
- Sets the allowed characters of this barcode
- setChecksum() : $this
- Sets the checksum validation method
- setLength() : $this
- Sets the length of this barcode
Properties
$columns
protected
array<string, int>
$columns
= ['0' => 1, '1' => 2, '2' => 3, '3' => 4, '4' => 5, '5' => 0, '6' => 1, '7' => 2, '8' => 3, '9' => 4, 'A' => 5, 'B' => 0, 'C' => 1, 'D' => 2, 'E' => 3, 'F' => 4, 'G' => 5, 'H' => 0, 'I' => 1, 'J' => 2, 'K' => 3, 'L' => 4, 'M' => 5, 'N' => 0, 'O' => 1, 'P' => 2, 'Q' => 3, 'R' => 4, 'S' => 5, 'T' => 0, 'U' => 1, 'V' => 2, 'W' => 3, 'X' => 4, 'Y' => 5, 'Z' => 0]
$options
Allowed options for this adapter
protected
array<string|int, mixed>
$options
= [
'length' => null,
// Allowed barcode lengths, integer, array, string
'characters' => null,
// Allowed barcode characters
'checksum' => null,
// Callback to checksum function
'useChecksum' => true,
]
$rows
protected
array<string, int>
$rows
= ['0' => 1, '1' => 1, '2' => 1, '3' => 1, '4' => 1, '5' => 1, '6' => 2, '7' => 2, '8' => 2, '9' => 2, 'A' => 2, 'B' => 2, 'C' => 3, 'D' => 3, 'E' => 3, 'F' => 3, 'G' => 3, 'H' => 3, 'I' => 4, 'J' => 4, 'K' => 4, 'L' => 4, 'M' => 4, 'N' => 4, 'O' => 5, 'P' => 5, 'Q' => 5, 'R' => 5, 'S' => 5, 'T' => 5, 'U' => 0, 'V' => 0, 'W' => 0, 'X' => 0, 'Y' => 0, 'Z' => 0]
Methods
__construct()
Constructor for this barcode adapter
public
__construct() : mixed
getCharacters()
Returns the allowed characters
public
getCharacters() : int|string|array<string|int, mixed>
Return values
int|string|array<string|int, mixed>getChecksum()
Returns the checksum function name
public
getChecksum() : string
Return values
stringgetLength()
Returns the allowed barcode length
public
getLength() : int|array<string|int, mixed>
Return values
int|array<string|int, mixed>hasValidCharacters()
Allows start and stop tag within checked chars
public
hasValidCharacters(string $value) : bool
Parameters
- $value : string
-
The barcode to check for allowed characters
Return values
boolhasValidChecksum()
Validates the checksum
public
hasValidChecksum(string $value) : bool
Parameters
- $value : string
-
The barcode to check the checksum for
Return values
boolhasValidLength()
Checks the length of a barcode
public
hasValidLength(string $value) : bool
Parameters
- $value : string
-
The barcode to check for proper length
Return values
booluseChecksum()
Sets the checksum validation, if no value is given, the actual setting is returned
public
useChecksum([bool $check = null ]) : AbstractAdapter|bool
Parameters
- $check : bool = null
Return values
AbstractAdapter|boolcode25()
Validates the checksum (Modulo 10) CODE25 implementation factor 3
protected
code25(string $value) : bool
Parameters
- $value : string
-
The barcode to validate
Return values
boolgtin()
Validates the checksum (Modulo 10) GTIN implementation factor 3
protected
gtin(string $value) : bool
Parameters
- $value : string
-
The barcode to validate
Return values
boolidentcode()
Validates the checksum (Modulo 10) IDENTCODE implementation factors 9 and 4
protected
identcode(string $value) : bool
Parameters
- $value : string
-
The barcode to validate
Return values
boolpostnet()
Validates the checksum () POSTNET implementation
protected
postnet(string $value) : bool
Parameters
- $value : string
-
The barcode to validate
Return values
boolroyalmail()
Validates the checksum ()
protected
royalmail(string $value) : bool
Parameters
- $value : string
-
The barcode to validate
Return values
boolsetCharacters()
Sets the allowed characters of this barcode
protected
setCharacters(int $characters) : $this
Parameters
- $characters : int
Return values
$thissetChecksum()
Sets the checksum validation method
protected
setChecksum(callable $checksum) : $this
Parameters
- $checksum : callable
-
Checksum method to call
Return values
$thissetLength()
Sets the length of this barcode
protected
setLength(int|array<string|int, mixed> $length) : $this
Parameters
- $length : int|array<string|int, mixed>