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

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:  * EanEight.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\EanEight;
22:  *
23:  * EanEight Barcode type class
24:  * EAN 8
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 EanEight extends \Com\Tecnick\Barcode\Type\Linear\EanOneThree
35: {
36:     /**
37:      * Barcode format
38:      *
39:      * @var string
40:      */
41:     protected $format = 'EAN8';
42: 
43:     /**
44:      * Fixed code length
45:      *
46:      * @var int
47:      */
48:     protected $code_length = 8;
49:     
50:     /**
51:      * Get the bars array
52:      *
53:      * @throws BarcodeException in case of error
54:      */
55:     protected function setBars()
56:     {
57:         $this->formatCode();
58:         $seq = '101'; // left guard bar
59:         $half_len = intval(ceil($this->code_length / 2));
60:         for ($pos = 0; $pos < $half_len; ++$pos) {
61:             $seq .= $this->chbar['A'][$this->extcode[$pos]];
62:         }
63:         $seq .= '01010'; // center guard bar
64:         for ($pos = $half_len; $pos < $this->code_length; ++$pos) {
65:             $seq .= $this->chbar['C'][$this->extcode[$pos]];
66:         }
67:         $seq .= '101'; // right guard bar
68:         $this->processBinarySequence($seq);
69:     }
70: }
71: 
 

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