source-class-Com.Tecnick.Barcode.Type.Linear.EanFive

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.
Overview

Classes

Exceptions

 1: <?php
 2: /**
 3:  * EanFive.php
 4:  *
 5:  * @since       2015-02-21
 6:  * @category    Library
 7:  * @package     Barcode
 8:  * @author      Nicola Asuni <info@tecnick.com>
 9:  * @copyright   2010-2016 Nicola Asuni - Tecnick.com LTD
10:  * @license     http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
11:  * @link        https://github.com/tecnickcom/tc-lib-barcode
12:  *
13:  * This file is part of tc-lib-barcode software library.
14:  */
15: 
16: namespace Com\Tecnick\Barcode\Type\Linear;
17: 
18: use \Com\Tecnick\Barcode\Exception as BarcodeException;
19: 
20: /**
21:  * Com\Tecnick\Barcode\Type\Linear\EanFive;
22:  *
23:  * EanFive Barcode type class
24:  * EAN 5-Digits UPC-Based Extension
25:  *
26:  * @since       2015-02-21
27:  * @category    Library
28:  * @package     Barcode
29:  * @author      Nicola Asuni <info@tecnick.com>
30:  * @copyright   2010-2016 Nicola Asuni - Tecnick.com LTD
31:  * @license     http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
32:  * @link        https://github.com/tecnickcom/tc-lib-barcode
33:  */
34: class EanFive extends \Com\Tecnick\Barcode\Type\Linear\EanTwo
35: {
36:     /**
37:      * Barcode format
38:      *
39:      * @var string
40:      */
41:     protected $format = 'EAN5';
42: 
43:     /**
44:      * Fixed code length
45:      *
46:      * @var int
47:      */
48:     protected $code_length = 5;
49: 
50:     /**
51:      * Map parities
52:      *
53:      * @var array
54:      */
55:     protected $parities = array(
56:         '0' => array('B','B','A','A','A'),
57:         '1' => array('B','A','B','A','A'),
58:         '2' => array('B','A','A','B','A'),
59:         '3' => array('B','A','A','A','B'),
60:         '4' => array('A','B','B','A','A'),
61:         '5' => array('A','A','B','B','A'),
62:         '6' => array('A','A','A','B','B'),
63:         '7' => array('A','B','A','B','A'),
64:         '8' => array('A','B','A','A','B'),
65:         '9' => array('A','A','B','A','B')
66:     );
67: 
68:     /**
69:      * Calculate checksum
70:      *
71:      * @param $code (string) code to represent.
72:      *
73:      * @return char checksum.
74:      */
75:     protected function getChecksum($code)
76:     {
77:         return (((3 * (intval($code[0]) + intval($code[2]) + intval($code[4])))
78:             + (9 * (intval($code[1]) + intval($code[3])))) % 10);
79:     }
80: }
81: 
 

© 2004-2017 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy