Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Zend_Validate_Barcode_Issn Class Reference
Inheritance diagram for Zend_Validate_Barcode_Issn:
Zend_Validate_Barcode_AdapterAbstract Zend_Validate_Barcode_AdapterInterface

Public Member Functions

 checkChars ($value)
 
 checksum ($value)
 
- Public Member Functions inherited from Zend_Validate_Barcode_AdapterAbstract
 checkLength ($value)
 
 checkChars ($value)
 
 checksum ($value)
 
 getLength ()
 
 getCharacters ()
 
 getChecksum ()
 
 getCheck ()
 
 setCheck ($check)
 

Protected Member Functions

 _issn ($value)
 
- Protected Member Functions inherited from Zend_Validate_Barcode_AdapterAbstract
 _gtin ($value)
 
 _identcode ($value)
 
 _code25 ($value)
 
 _postnet ($value)
 

Protected Attributes

 $_length = array(8, 13)
 
 $_characters = '0123456789X'
 
 $_checksum = '_gtin'
 
- Protected Attributes inherited from Zend_Validate_Barcode_AdapterAbstract
 $_length
 
 $_characters
 
 $_checksum
 
 $_hasChecksum = true
 

Detailed Description

Definition at line 33 of file Issn.php.

Member Function Documentation

◆ _issn()

_issn (   $value)
protected

Validates the checksum () ISSN implementation (reversed mod11)

Parameters
string$valueThe barcode to validate
Returns
boolean

Definition at line 94 of file Issn.php.

95  {
96  $checksum = substr($value, -1, 1);
97  $values = str_split(substr($value, 0, -1));
98  $check = 0;
99  $multi = 8;
100  foreach($values as $token) {
101  if ($token == 'X') {
102  $token = 10;
103  }
104 
105  $check += ($token * $multi);
106  --$multi;
107  }
108 
109  $check %= 11;
110  $check = 11 - $check;
111  if ($check == $checksum) {
112  return true;
113  } else if (($check == 10) && ($checksum == 'X')) {
114  return true;
115  }
116 
117  return false;
118  }
$values
Definition: options.phtml:88
$value
Definition: gender.phtml:16

◆ checkChars()

checkChars (   $value)

Allows X on length of 8 chars

Parameters
string$valueThe barcode to check for allowed characters
Returns
boolean

Implements Zend_Validate_Barcode_AdapterInterface.

Definition at line 59 of file Issn.php.

60  {
61  if (strlen($value) != 8) {
62  if (strpos($value, 'X') !== false) {
63  return false;
64  }
65  }
66 
67  return parent::checkChars($value);
68  }
$value
Definition: gender.phtml:16

◆ checksum()

checksum (   $value)

Validates the checksum

Parameters
string$valueThe barcode to check the checksum for
Returns
boolean

Implements Zend_Validate_Barcode_AdapterInterface.

Definition at line 76 of file Issn.php.

77  {
78  if (strlen($value) == 8) {
79  $this->_checksum = '_issn';
80  } else {
81  $this->_checksum = '_gtin';
82  }
83 
84  return parent::checksum($value);
85  }
$value
Definition: gender.phtml:16

Field Documentation

◆ $_characters

$_characters = '0123456789X'
protected

Definition at line 45 of file Issn.php.

◆ $_checksum

$_checksum = '_gtin'
protected

Definition at line 51 of file Issn.php.

◆ $_length

$_length = array(8, 13)
protected

Definition at line 39 of file Issn.php.


The documentation for this class was generated from the following file: