1<?php
2/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
3
4/**
5 * Image_Barcode2_Common class
6 *
7 * Common code
8 *
9 * PHP versions 5
10 *
11 * LICENSE: This source file is subject to version 3.0 of the PHP license
12 * that is available through the world-wide-web at the following URI:
13 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
14 * the PHP License and are unable to obtain it through the web, please
15 * send a note to license@php.net so we can mail you a copy immediately.
16 *
17 * @category  Image
18 * @package   Image_Barcode2
19 * @author    Ryan Briones <ryanbriones@webxdesign.org>
20 * @copyright 2005 The PHP Group
21 * @license   http://www.php.net/license/3_0.txt  PHP License 3.0
22 * @link      http://pear.php.net/package/Image_Barcode2
23 */
24/**
25 * Image_Barcode2_Common class
26 *
27 * Common code
28 *
29 * @category  Image
30 * @package   Image_Barcode2
31 * @author    Ryan Briones <ryanbriones@webxdesign.org>
32 * @copyright 2005 The PHP Group
33 * @license   http://www.php.net/license/3_0.txt  PHP License 3.0
34 * @version   Release: @package_version@
35 * @link      http://pear.php.net/package/Image_Barcode2
36 */
37class Image_Barcode2_Common
38{
39    protected $barcodeheight;
40    protected $barcodewidth;
41    protected $barcodethinwidth;
42    protected $barcodethickwidth;
43    protected $fontsize = 2;
44    protected $showText;
45
46    /**
47     * @var Image_Barcode2_Writer
48     */
49    protected $writer;
50
51    /**
52     * @var string barcode
53     */
54    protected $barcode;
55
56
57    /**
58     * Class constructor
59     *
60     * @param Image_Barcode2_Writer $writer Library to use.
61     */
62    public function __construct(Image_Barcode2_Writer $writer)
63    {
64        $this->setWriter($writer);
65    }
66
67    /**
68     * Set the image rendering library.
69     *
70     * @param Image_Barcode2_Writer $writer Library to use.
71     *
72     * @return void
73     */
74    public function setWriter(Image_Barcode2_Writer $writer)
75    {
76        $this->writer = $writer;
77    }
78
79    /**
80     * Get the image rendering library.
81     *
82     * @return Image_Barcode2_Writer
83     */
84    public function getWriter()
85    {
86        return $this->writer;
87    }
88
89    /**
90     * Set the barcode
91     *
92     * @param string $barcode barcode
93     *
94     * @return void
95     */
96    public function setBarcode($barcode)
97    {
98        $this->barcode = trim($barcode);
99    }
100
101    /**
102     * Get the barcode
103     *
104     * @return string
105     */
106    public function getBarcode()
107    {
108        return $this->barcode;
109    }
110
111    /**
112     * Set if text will be placed under the barcode
113     *
114     * @param boolean $showText The text should be placed under barcode
115     *
116     * @return void
117     */
118    public function setShowText($showText)
119    {
120        $this->showText = $showText;
121    }
122
123    /**
124     * Get if text will be placed under the barcode
125     *
126     * @return boolean
127     */
128    public function getShowText()
129    {
130        return $this->showText;
131    }
132
133    public function setFontSize($size)
134    {
135        $this->fontsize = $size;
136    }
137
138    public function getFontSize()
139    {
140        return $this->fontsize;
141    }
142
143    public function setBarcodeHeight($height)
144    {
145        $this->barcodeheight = $height;
146    }
147
148    public function getBarcodeHeight()
149    {
150        return $this->barcodeheight;
151    }
152
153    public function setBarcodeWidth($width)
154    {
155        $this->barcodewidth = $width;
156    }
157
158    public function getBarcodeWidth()
159    {
160        return $this->barcodewidth;
161    }
162
163    public function setBarcodeWidthThick($width)
164    {
165        $this->barcodethickwidth = $width;
166    }
167
168    public function getBarcodeWidthThick()
169    {
170        return $this->barcodethickwidth;
171    }
172
173    public function setBarcodeWidthThin($width)
174    {
175        $this->barcodethinwidth = $width;
176    }
177
178    public function getBarcodeWidthThin()
179    {
180        return $this->barcodethinwidth;
181    }
182}
183