Definition at line 38 of file Barcode.php.
◆ __construct()
Generates the standard validator object
- Parameters
-
string|Zend_Config| | Zend_Validate_Barcode_BarcodeAdapter $adapter Barcode adapter to use |
- Exceptions
-
Definition at line 82 of file Barcode.php.
91 if (array_key_exists(
'options',
$adapter)) {
95 if (array_key_exists(
'checksum',
$adapter)) {
99 if (array_key_exists(
'adapter',
$adapter)) {
102 #require_once 'Zend/Validate/Exception.php'; 108 if ($checksum !==
null) {
setAdapter($adapter, $options=null)
◆ getAdapter()
Returns the set adapter
- Returns
- Zend_Validate_Barcode_BarcodeAdapter
Definition at line 118 of file Barcode.php.
◆ getChecksum()
Returns the checksum option
- Returns
- boolean
Definition at line 159 of file Barcode.php.
◆ isValid()
Defined by Zend_Validate_Interface
Returns true if and only if $value contains a valid barcode
- Parameters
-
- Returns
- boolean
Implements Zend_Validate_Interface.
Definition at line 184 of file Barcode.php.
187 $this->
_error(self::INVALID);
193 $this->_length =
$adapter->getLength();
196 if (is_array($this->_length)) {
199 foreach($temp as $length) {
200 $this->_length .=
"/";
201 $this->_length .= $length;
204 $this->_length = substr($this->_length, 1);
207 $this->
_error(self::INVALID_LENGTH);
213 $this->
_error(self::INVALID_CHARS);
220 $this->
_error(self::FAILED);
_error($messageKey, $value=null)
◆ setAdapter()
setAdapter |
( |
|
$adapter, |
|
|
|
$options = null |
|
) |
| |
Sets a new barcode adapter
- Parameters
-
- Returns
- $this
- Exceptions
-
Definition at line 131 of file Barcode.php.
134 #require_once 'Zend/Loader.php'; 145 #require_once 'Zend/Validate/Exception.php'; 147 "Adapter " .
$adapter .
" does not implement Zend_Validate_Barcode_AdapterInterface" static loadClass($class, $dirs=null)
static isReadable($filename)
◆ setChecksum()
◆ $_adapter
◆ $_length
◆ $_messageTemplates
Initial value:= array(
self::FAILED => "'%value%' failed checksum validation",
self::INVALID_CHARS => "'%value%' contains invalid characters",
self::INVALID_LENGTH => "'%value%' should have a length of %length% characters",
self::INVALID => "Invalid type given. String expected",
)
Definition at line 45 of file Barcode.php.
◆ $_messageVariables
Initial value:= array(
'length' => '_length'
)
Definition at line 57 of file Barcode.php.
◆ FAILED
const FAILED = 'barcodeFailed' |
◆ INVALID
const INVALID = 'barcodeInvalid' |
◆ INVALID_CHARS
const INVALID_CHARS = 'barcodeInvalidChars' |
◆ INVALID_LENGTH
const INVALID_LENGTH = 'barcodeInvalidLength' |
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Validate/Barcode.php