3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Validator\Barcode
;
12 class Upce
extends AbstractAdapter
15 * Constructor for this barcode adapter
17 public function __construct()
19 $this->setLength(array(6, 7, 8));
20 $this->setCharacters('0123456789');
21 $this->setChecksum('gtin');
25 * Overrides parent checkLength
27 * @param string $value Value
30 public function hasValidLength($value)
32 if (strlen($value) != 8) {
33 $this->useChecksum(false);
35 $this->useChecksum(true);
38 return parent
::hasValidLength($value);