Itf14.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Barcode
  17. * @subpackage Object
  18. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /** @see Zend_Barcode_Object_Int25 */
  23. require_once 'Zend/Barcode/Object/Int25.php';
  24. /** @see Zend_Validate_Barcode */
  25. require_once 'Zend/Validate/Barcode.php';
  26. /**
  27. * Class for generate Itf14 barcode
  28. *
  29. * @category Zend
  30. * @package Zend_Barcode
  31. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. class Zend_Barcode_Object_Itf14 extends Zend_Barcode_Object_Int25
  35. {
  36. /**
  37. * @var $_barcodeLength integer | string
  38. */
  39. protected $_barcodeLength = 14;
  40. /**
  41. * Constructor
  42. * @param array|Zend_Config $options
  43. * @return void
  44. */
  45. public function __construct($options = null)
  46. {
  47. parent::__construct($options);
  48. // Checksum is mandatory with Itf14
  49. $this->_withChecksum = true;
  50. // Default to true but not mandatory
  51. $this->_withChecksumInText = true;
  52. }
  53. /**
  54. * Activate/deactivate the automatic generation
  55. * of the checksum character
  56. * added to the barcode text
  57. * @param boolean $value
  58. * @return Zend_Barcode_Object
  59. */
  60. public function setWithChecksum($value)
  61. {
  62. // Checksum is mandatory with Itf14
  63. return $this;
  64. }
  65. /**
  66. * Activate/deactivate the automatic generation
  67. * of the checksum character
  68. * added to the barcode text
  69. * @param boolean $value
  70. * @return Zend_Barcode_Object
  71. * @throw Zend_Barcode_Object_Exception
  72. */
  73. public function setWithChecksumInText($value)
  74. {
  75. return $this;
  76. }
  77. /**
  78. * Check allowed characters
  79. * @param string $value
  80. * @return string
  81. * @throw Zend_Barcode_Object_Exception
  82. */
  83. public function validateText($value)
  84. {
  85. $this->_validateText($value, array('automaticPrepend' => 0, 'substituteChecksumCharacter' => 0));
  86. }
  87. }