HumHub Documentation (unofficial)

Ean5 extends AbstractAdapter
in package

Table of Contents

Properties

$options  : array<string|int, mixed>
Allowed options for this adapter

Methods

__construct()  : mixed
Constructor
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
Checks for allowed characters within the barcode
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
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

$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, ]

Methods

__construct()

Constructor

public __construct() : mixed

Sets check flag to false.

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
string

getLength()

Returns the allowed barcode length

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

hasValidCharacters()

Checks for allowed characters within the barcode

public hasValidCharacters(string $value) : bool
Parameters
$value : string

The barcode to check for allowed characters

Return values
bool

hasValidChecksum()

Validates the checksum

public hasValidChecksum(string $value) : bool
Parameters
$value : string

The barcode to check the checksum for

Return values
bool

hasValidLength()

Checks the length of a barcode

public hasValidLength(string $value) : bool
Parameters
$value : string

The barcode to check for proper length

Return values
bool

useChecksum()

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|bool

code25()

Validates the checksum (Modulo 10) CODE25 implementation factor 3

protected code25(string $value) : bool
Parameters
$value : string

The barcode to validate

Return values
bool

gtin()

Validates the checksum (Modulo 10) GTIN implementation factor 3

protected gtin(string $value) : bool
Parameters
$value : string

The barcode to validate

Return values
bool

identcode()

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
bool

postnet()

Validates the checksum () POSTNET implementation

protected postnet(string $value) : bool
Parameters
$value : string

The barcode to validate

Return values
bool

setCharacters()

Sets the allowed characters of this barcode

protected setCharacters(int $characters) : $this
Parameters
$characters : int
Return values
$this

setChecksum()

Sets the checksum validation method

protected setChecksum(callable $checksum) : $this
Parameters
$checksum : callable

Checksum method to call

Return values
$this

setLength()

Sets the length of this barcode

protected setLength(int|array<string|int, mixed> $length) : $this
Parameters
$length : int|array<string|int, mixed>
Return values
$this

        
On this page

Search results