diff options
author | robocoder <anthon.pang@gmail.com> | 2010-01-29 12:02:30 +0300 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2010-01-29 12:02:30 +0300 |
commit | 1378f79297baa84590738839ec11cef90ac21bc4 (patch) | |
tree | 61b8272e59891a9d5d175d8a883a978fd913daf0 /libs/Zend/Validate/Barcode/Ean8.php | |
parent | f156256d1f2537e6e448c7b8b5852d59a0e9099e (diff) |
update wrt Zend Framework 1.10.0; remove svn:eol-style property
git-svn-id: http://dev.piwik.org/svn/trunk@1813 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'libs/Zend/Validate/Barcode/Ean8.php')
-rw-r--r-- | libs/Zend/Validate/Barcode/Ean8.php | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/libs/Zend/Validate/Barcode/Ean8.php b/libs/Zend/Validate/Barcode/Ean8.php new file mode 100644 index 0000000000..c87af039fd --- /dev/null +++ b/libs/Zend/Validate/Barcode/Ean8.php @@ -0,0 +1,69 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Validate + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id:$ + */ + +/** + * @see Zend_Validate_Barcode_AdapterAbstract + */ +require_once 'Zend/Validate/Barcode/AdapterAbstract.php'; + +/** + * @category Zend + * @package Zend_Validate + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Validate_Barcode_Ean8 extends Zend_Validate_Barcode_AdapterAbstract +{ + /** + * Allowed barcode lengths + * @var integer + */ + protected $_length = array(7, 8); + + /** + * Allowed barcode characters + * @var string + */ + protected $_characters = '0123456789'; + + /** + * Checksum function + * @var string + */ + protected $_checksum = '_gtin'; + + /** + * Overrides parent checkLength + * + * @param string $value Value + * @return boolean + */ + public function checkLength($value) + { + if (strlen($value) == 7) { + $this->setCheck(false); + } else { + $this->setCheck(true); + } + + return parent::checkLength($value); + } +} |