VuFindCode API Documentation

EAN
in package

EAN Class

This class provides EAN validation and checksumming functionality.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Main Page

Table of Contents

getEAN13CheckDigit()  : string
Given the first 12 digits of an EAN, generate the check digit.
isValidEAN13()  : bool
Is the provided EAN valid?
normalizeEAN()  : string
Return the first sequence of at least 12 digits followed by an optional X.

Methods

getEAN13CheckDigit()

Given the first 12 digits of an EAN, generate the check digit.

public static getEAN13CheckDigit(string $ean) : string
Parameters
$ean : string

The first 12 digits of an EAN.

Return values
string

The check digit.

isValidEAN13()

Is the provided EAN valid?

public static isValidEAN13(string $ean) : bool
Parameters
$ean : string

The EAN to test.

Return values
bool

normalizeEAN()

Return the first sequence of at least 12 digits followed by an optional X.

public static normalizeEAN(string $raw) : string

These characters may be separated by any number of '.', '-', '_' and whitespace characters; the separation characters are removed. A lower x is converted to an upper X.

Parameters
$raw : string

EAN to clean up.

Return values
string

Normalized EAN.

Search results