本文整理汇总了PHP中Zend_Validate_Barcode::getMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Validate_Barcode::getMessages方法的具体用法?PHP Zend_Validate_Barcode::getMessages怎么用?PHP Zend_Validate_Barcode::getMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Validate_Barcode
的用法示例。
在下文中一共展示了Zend_Validate_Barcode::getMessages方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInvalidChecksumAdapter
public function testInvalidChecksumAdapter()
{
// require_once dirname(__FILE__) . "/_files/MyBarcode1.php";
$barcode = new Zend_Validate_Barcode('MyBarcode1');
$this->assertFalse($barcode->isValid('0000000'));
$this->assertTrue(array_key_exists('barcodeFailed', $barcode->getMessages()));
$this->assertFalse($barcode->getAdapter()->checksum('0000000'));
}
示例2: _validateText
/**
* Particular validation for Upce barcode objects
* (to suppress checksum character substitution)
*
* @param string $value
* @param array $options
* @throws Zend_Barcode_Object_Exception
*/
protected function _validateText($value, $options = array())
{
$validator = new Zend_Validate_Barcode(array('adapter' => 'upce', 'checksum' => false));
$value = $this->_addLeadingZeros($value, true);
if (!$validator->isValid($value)) {
$message = implode("\n", $validator->getMessages());
/**
* @see Zend_Barcode_Object_Exception
*/
throw new Zend_Barcode_Object_Exception($message);
}
}
示例3: testArrayLengthMessage
/**
* @group ZF-10116
*/
public function testArrayLengthMessage()
{
$barcode = new Zend_Validate_Barcode('ean8');
$this->assertFalse($barcode->isValid('123'));
$message = $barcode->getMessages();
$this->assertTrue(array_key_exists('barcodeInvalidLength', $message));
$this->assertContains("length of 7/8 characters", $message['barcodeInvalidLength']);
}
示例4: _validateText
/**
* Standard validation for most of barcode objects
* @param string $value
* @param array $options
*/
protected function _validateText($value, $options = array())
{
$validatorName = isset($options['validator']) ? $options['validator'] : $this->getType();
$validator = new Zend_Validate_Barcode(array('adapter' => $validatorName, 'checksum' => false));
$checksumCharacter = '';
$withChecksum = false;
if ($this->_mandatoryChecksum) {
$checksumCharacter = $this->_substituteChecksumCharacter;
$withChecksum = true;
}
$value = $this->_addLeadingZeros($value, $withChecksum) . $checksumCharacter;
if (!$validator->isValid($value)) {
$message = implode("\n", $validator->getMessages());
/**
* @see Zend_Barcode_Object_Exception
*/
require_once 'Zend/Barcode/Object/Exception.php';
throw new Zend_Barcode_Object_Exception($message);
}
}
示例5: _validateText
/**
* Particular validation for Ean8 barcode objects
* (to suppress checksum character substitution)
* @param string $value
* @param array $options
*/
protected function _validateText($value, $options = array())
{
$validator = new Zend_Validate_Barcode(array('adapter' => 'ean8', 'checksum' => false));
$value = $this->_addLeadingZeros($value, true);
if (!$validator->isValid($value)) {
$message = implode("\n", $validator->getMessages());
/**
* @see Zend_Barcode_Object_Exception
*/
require_once PHP_LIBRARY_PATH . 'Zend/Barcode/Object/Exception.php';
throw new Zend_Barcode_Object_Exception($message);
}
}