Definition at line 33 of file AdapterAbstract.php.
◆ _code25()
Validates the checksum (Modulo 10) CODE25 implementation factor 3
- Parameters
-
string | $value | The barcode to validate |
- Returns
- boolean
Definition at line 267 of file AdapterAbstract.php.
269 $barcode = substr(
$value, 0, -1);
271 $length = strlen($barcode) - 1;
273 for (
$i = 0;
$i <= $length;
$i++) {
274 if ((
$i % 2) === 0) {
275 $sum += $barcode[
$i] * 3;
277 $sum += $barcode[
$i];
282 $checksum = ($calc === 0) ? 0 : (10 - $calc);
283 if (
$value[$length + 1] != $checksum) {
◆ _gtin()
Validates the checksum (Modulo 10) GTIN implementation factor 3
- Parameters
-
string | $value | The barcode to validate |
- Returns
- boolean
Definition at line 207 of file AdapterAbstract.php.
209 $barcode = substr(
$value, 0, -1);
211 $length = strlen($barcode) - 1;
213 for (
$i = 0;
$i <= $length;
$i++) {
214 if ((
$i % 2) === 0) {
215 $sum += $barcode[$length -
$i] * 3;
217 $sum += $barcode[$length -
$i];
222 $checksum = ($calc === 0) ? 0 : (10 - $calc);
223 if (
$value[$length + 1] != $checksum) {
◆ _identcode()
Validates the checksum (Modulo 10) IDENTCODE implementation factors 9 and 4
- Parameters
-
string | $value | The barcode to validate |
- Returns
- boolean
Definition at line 237 of file AdapterAbstract.php.
239 $barcode = substr(
$value, 0, -1);
241 $length = strlen(
$value) - 2;
243 for (
$i = 0;
$i <= $length;
$i++) {
244 if ((
$i % 2) === 0) {
245 $sum += $barcode[$length -
$i] * 4;
247 $sum += $barcode[$length -
$i] * 9;
252 $checksum = ($calc === 0) ? 0 : (10 - $calc);
253 if (
$value[$length + 1] != $checksum) {
◆ _postnet()
Validates the checksum () POSTNET implementation
- Parameters
-
string | $value | The barcode to validate |
- Returns
- boolean
Definition at line 297 of file AdapterAbstract.php.
299 $checksum = substr(
$value, -1, 1);
308 $check = 10 - $check;
309 if ($check == $checksum) {
◆ checkChars()
Checks for allowed characters within the barcode
- Parameters
-
string | $value | The barcode to check for allowed characters |
- Returns
- boolean
Implements Zend_Validate_Barcode_AdapterInterface.
Definition at line 106 of file AdapterAbstract.php.
113 if ($characters == 128) {
114 for ($x = 0; $x < 128; ++$x) {
118 $chars = str_split($characters);
119 foreach ($chars as $char) {
◆ checkLength()
Checks the length of a barcode
- Parameters
-
string | $value | The barcode to check for proper length |
- Returns
- boolean
Implements Zend_Validate_Barcode_AdapterInterface.
Definition at line 66 of file AdapterAbstract.php.
75 if (is_array($length)) {
76 foreach ($length as
$value) {
85 }
elseif ($fixum == $length) {
89 }
elseif ($length ==
'even') {
91 $found = (
$count == 0) ?
true :
false;
92 }
elseif ($length ==
'odd') {
94 $found = (
$count == 1) ?
true :
false;
elseif(isset( $params[ 'redirect_parent']))
◆ checksum()
Validates the checksum
- Parameters
-
string | $value | The barcode to check the checksum for |
- Returns
- boolean
Implements Zend_Validate_Barcode_AdapterInterface.
Definition at line 137 of file AdapterAbstract.php.
140 if (!empty($checksum)) {
141 if (method_exists($this, $checksum)) {
call_user_func($callable, $param)
◆ getCharacters()
◆ getCheck()
◆ getChecksum()
◆ getLength()
◆ setCheck()
◆ $_characters
◆ $_checksum
◆ $_hasChecksum
◆ $_length
The documentation for this class was generated from the following file: