Skip to content

Commit

Permalink
Classes draw barcode moved to folder "Driver".
Browse files Browse the repository at this point in the history
working issue #3
  • Loading branch information
Gemorroj committed Mar 8, 2012
1 parent f9d0e13 commit d57dd5b
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 49 deletions.
6 changes: 3 additions & 3 deletions Image/Barcode2.php
Expand Up @@ -80,7 +80,7 @@ class Image_Barcode2
* @param integer $height The image height
* @param integer $width The image width
*
* @return image The corresponding gd image object;
* @return resource The corresponding gd image resource
*
* @throws Image_Barcode2_Exception
* @access public
Expand All @@ -100,11 +100,11 @@ public static function draw($text,
throw new Image_Barcode2_Exception('Invalid barcode type ' . $type);
}

if (!include_once 'Image/Barcode2/' . ucfirst($type) . '.php') {
if (!include_once 'Image/Barcode2/Driver/' . ucfirst($type) . '.php') {
throw new Image_Barcode2_Exception($type . ' barcode is not supported');
}

$classname = 'Image_Barcode2_' . ucfirst($type);
$classname = 'Image_Barcode2_Driver_' . ucfirst($type);

$obj = new $classname(new Image_Barcode2_Writer());

Expand Down
2 changes: 1 addition & 1 deletion Image/Barcode2/Common.php
Expand Up @@ -51,7 +51,7 @@ public function getWriter()
/**
* Set the barcode
*
* @param string $barcode
* @param string $barcode barcode
*/
public function setBarcode($barcode)
{
Expand Down
2 changes: 1 addition & 1 deletion Image/Barcode2/Driver.php
Expand Up @@ -4,7 +4,7 @@ interface Image_Barcode2_Driver
/**
* Draws a barcode
*
* @return image The corresponding image barcode
* @return resource The corresponding image barcode
*/
public function draw();

Expand Down
Expand Up @@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */

/**
* Image_Barcode2_Code128 class
* Image_Barcode2_Driver_Code128 class
*
* Renders Code128 barcodes
* Code128 is a high density encoding for alphanumeric strings.
Expand Down Expand Up @@ -57,7 +57,7 @@
* @link http://pear.php.net/package/Image_Barcode2
*/

class Image_Barcode2_Code128 extends Image_Barcode2_Common implements Image_Barcode2_Driver
class Image_Barcode2_Driver_Code128 extends Image_Barcode2_Common implements Image_Barcode2_Driver
{
var $_code = array();

Expand Down Expand Up @@ -193,7 +193,7 @@ public function validate()
* Draws a Code128 image barcode
*
*
* @return image The corresponding interleaved 2 of 5 image barcode
* @return resource The corresponding Code128 image barcode
*
* @access public
*
Expand All @@ -204,7 +204,6 @@ public function validate()
* the input string and convert it to a string of barcode widths.
* Then, we size and allocate the image. Finally, we print the bars to
* the image along with the barcode text and display it to the beholder.
*
*/
public function draw()
{
Expand Down
Expand Up @@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */

/**
* Image_Barcode2_Code39 class
* Image_Barcode2_Driver_Code39 class
*
* Image_Barcode2_Code39 creates Code 3 of 9 ( Code39 ) barcode images. It's
* implementation borrows heavily for the perl module GD::Barcode::Code39
Expand Down Expand Up @@ -30,9 +30,9 @@
require_once 'Image/Barcode2/Exception.php';

/**
* Image_Barcode2_Code39 class
* Code 3 of 9
*
* Package which provides a method to create Code39 using GD library.
* Package which provides a method to create Code 3 of 9 using GD library.
*
* @category Image
* @package Image_Barcode2
Expand All @@ -43,7 +43,7 @@
* @link http://pear.php.net/package/Image_Barcode2
* @since Image_Barcode2 0.5
*/
class Image_Barcode2_Code39 extends Image_Barcode2_Common implements Image_Barcode2_Driver, Image_Barcode2_DualWidth
class Image_Barcode2_Driver_Code39 extends Image_Barcode2_Common implements Image_Barcode2_Driver, Image_Barcode2_DualWidth
{
/**
* Coding map
Expand Down
14 changes: 7 additions & 7 deletions Image/Barcode2/Ean13.php → Image/Barcode2/Driver/Ean13.php
Expand Up @@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */

/**
* Image_Barcode2_Ean13 class
* Image_Barcode2_Driver_Ean13 class
*
* Renders EAN 13 barcodes
*
Expand All @@ -15,20 +15,20 @@
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category Image
* @package Image_Barcode
* @package Image_Barcode2
* @author Didier Fournout <didier.fournout@nyc.fr>
* @copyright 2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id$
* @link http://pear.php.net/package/Image_Barcode
* @link http://pear.php.net/package/Image_Barcode2
*/

require_once 'Image/Barcode2/Driver.php';
require_once 'Image/Barcode2/Common.php';
require_once 'Image/Barcode2/Exception.php';

/**
* Image_Barcode2_ean13 class
* EAN 13
*
* Package which provides a method to create EAN 13 barcode using GD library.
*
Expand All @@ -38,10 +38,10 @@
* @copyright 2005 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version Release: @package_version@
* @link http://pear.php.net/package/Image_Barcode
* @link http://pear.php.net/package/Image_Barcode2
* @since Image_Barcode2 0.4
*/
class Image_Barcode2_Ean13 extends Image_Barcode2_Common implements Image_Barcode2_Driver
class Image_Barcode2_Driver_Ean13 extends Image_Barcode2_Common implements Image_Barcode2_Driver
{
/**
* Number set
Expand Down Expand Up @@ -144,7 +144,7 @@ public function validate()
* Draws a EAN 13 image barcode
*
*
* @return image The corresponding Interleaved 2 of 5 image barcode
* @return resource The corresponding EAN13 image barcode
*
* @access public
*
Expand Down
10 changes: 5 additions & 5 deletions Image/Barcode2/Ean8.php → Image/Barcode2/Driver/Ean8.php
Expand Up @@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */

/**
* Image_Barcode2_Ean8 class
* Image_Barcode2_Driver_Ean8 class
*
* Renders EAN 8 barcodes
*
Expand All @@ -29,9 +29,9 @@
require_once 'Image/Barcode2/Exception.php';

/**
* Image_Barcode2_ean8 class
* EAN 8
*
* Package which provides a method to create EAN 13 barcode using GD library.
* Package which provides a method to create EAN 8 barcode using GD library.
*
* @category Image
* @package Image_Barcode2
Expand All @@ -42,7 +42,7 @@
* @version Release: @package_version@
* @link http://pear.php.net/package/Image_Barcode2
*/
class Image_Barcode2_Ean8 extends Image_Barcode2_Common implements Image_Barcode2_Driver
class Image_Barcode2_Driver_Ean8 extends Image_Barcode2_Common implements Image_Barcode2_Driver
{
/**
* Number set
Expand Down Expand Up @@ -121,7 +121,7 @@ public function validate()
/**
* Draws a EAN 8 image barcode
*
* @return image The corresponding EAN8 image barcode
* @return resource The corresponding EAN8 image barcode
*
* @access public
*
Expand Down
8 changes: 4 additions & 4 deletions Image/Barcode2/Int25.php → Image/Barcode2/Driver/Int25.php
Expand Up @@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */

/**
* Image_Barcode2_Int25 class
* Image_Barcode2_Driver_Int25 class
*
* Renders Interleaved 2 of 5 barcodes
*
Expand All @@ -29,7 +29,7 @@
require_once 'Image/Barcode2/Exception.php';

/**
* Image_Barcode2_int25 class
* Interleaved 2 of 5
*
* Package which provides a method to create Interleaved 2 of 5
* barcode using GD library.
Expand All @@ -42,7 +42,7 @@
* @version Release: @package_version@
* @link http://pear.php.net/package/Image_Barcode2
*/
class Image_Barcode2_Int25 extends Image_Barcode2_Common implements Image_Barcode2_Driver, Image_Barcode2_DualWidth
class Image_Barcode2_Driver_Int25 extends Image_Barcode2_Common implements Image_Barcode2_Driver, Image_Barcode2_DualWidth
{
/**
* Coding map
Expand Down Expand Up @@ -92,7 +92,7 @@ public function validate()
/**
* Draws a Interleaved 2 of 5 image barcode
*
* @return image The corresponding Interleaved 2 of 5 image barcode
* @return resource The corresponding Interleaved 2 of 5 image barcode
*
* @access public
*
Expand Down
Expand Up @@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */

/**
* Image_Barcode2_Postnet class
* Image_Barcode2_Driver_Postnet class
*
* Renders PostNet barcodes
*
Expand Down Expand Up @@ -42,7 +42,7 @@
require_once 'Image/Barcode2/Exception.php';

/**
* Image_Barcode2_Postnet class
* PostNet
*
* Package which provides a method to create PostNet barcode using GD library.
*
Expand All @@ -54,7 +54,7 @@
* @version Release: @package_version@
* @link http://pear.php.net/package/Image_Barcode2
*/
class Image_Barcode2_Postnet extends Image_Barcode2_Common implements Image_Barcode2_Driver, Image_Barcode2_DualHeight
class Image_Barcode2_Driver_Postnet extends Image_Barcode2_Common implements Image_Barcode2_Driver, Image_Barcode2_DualHeight
{
/**
* Bar short height
Expand Down Expand Up @@ -116,14 +116,13 @@ public function validate()
/**
* Draws a PostNet image barcode
*
* @return image The corresponding Interleaved 2 of 5 image barcode
* @return resource The corresponding PostNet image barcode
*
* @access public
*
* @author Josef "Jeff" Sipek <jeffpc@optonline.net>
* @since Image_Barcode2 0.3
*/

public function draw()
{
$text = $this->getBarcode();
Expand Down
8 changes: 4 additions & 4 deletions Image/Barcode2/Upca.php → Image/Barcode2/Driver/Upca.php
Expand Up @@ -2,7 +2,7 @@
/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */

/**
* Image_Barcode2_Upca class
* Image_Barcode2_Driver_Upca class
*
* Renders UPC-A barcodes
*
Expand All @@ -29,7 +29,7 @@
require_once 'Image/Barcode2/Exception.php';

/**
* Image_Barcode2_Upca class
* UPC-A
*
* Package which provides a method to create UPC-A barcode using GD library.
*
Expand All @@ -49,7 +49,7 @@
* @version Release: @package_version@
* @link http://pear.php.net/package/Image_Barcode2
*/
class Image_Barcode2_Upca extends Image_Barcode2_Common implements Image_Barcode2_Driver
class Image_Barcode2_Driver_Upca extends Image_Barcode2_Common implements Image_Barcode2_Driver
{
/**
* Number set
Expand Down Expand Up @@ -128,7 +128,7 @@ public function validate()
/**
* Draws a UPC-A image barcode
*
* @return image The corresponding Interleaved 2 of 5 image barcode
* @return resource The corresponding UPC-A image barcode
*
* @author Jeffrey K. Brown <jkb@darkfantastic.net>
* @author Didier Fournout <didier.fournout@nyc.fr>
Expand Down
22 changes: 11 additions & 11 deletions package.xml
Expand Up @@ -3,7 +3,7 @@
<name>Image_Barcode2</name>
<channel>pear.php.net</channel>
<summary>Barcode generation</summary>
<description>With Image_Barcode class you can create a barcode
<description>With Image_Barcode2 class you can create a barcode
representation of a given string.

This class uses GD function because of this the generated graphic can be any of
Expand Down Expand Up @@ -43,19 +43,19 @@ Increased use of Image_Barcode2_Exception
<file baseinstalldir="Image" md5sum="c27a1c8b14ee9d792819abafbfa20c85" name="docs/Readme.txt" role="doc" />
<file baseinstalldir="Image" md5sum="d274880933d54b873c9589087766c124" name="docs/examples/barcode_img.php" role="doc" />
<file baseinstalldir="Image" md5sum="07ecde340ef052307a4f61252f585039" name="docs/examples/test-image-barcode.php" role="doc" />
<file baseinstalldir="/" md5sum="b140216eaab1360f950f831f02315e6c" name="Image/Barcode2.php" role="php" />
<file baseinstalldir="/" md5sum="fc3c04330256ab81b1da52e8e3023b50" name="Image/Barcode2/Code39.php" role="php" />
<file baseinstalldir="/" md5sum="889c830d369966e7507f8cff9798996e" name="Image/Barcode2/Code128.php" role="php" />
<file baseinstalldir="/" md5sum="7e9a529b6308c2b577ea91800b8effb8" name="Image/Barcode2/Common.php" role="php" />
<file baseinstalldir="/" md5sum="9ee567b017d84e7597933fe7a6c38c8d" name="Image/Barcode2/Driver.php" role="php" />
<file baseinstalldir="/" md5sum="e33b63ca7daf12daa2f33450e637bab6" name="Image/Barcode2.php" role="php" />
<file baseinstalldir="/" md5sum="4baeb7e65f2c3faa2e23633156af5811" name="Image/Barcode2/Driver/Code39.php" role="php" />
<file baseinstalldir="/" md5sum="c9579704cdadf6c16a12118bbabb0362" name="Image/Barcode2/Driver/Code128.php" role="php" />
<file baseinstalldir="/" md5sum="e719499234f736e5029a5e7d67b70996" name="Image/Barcode2/Common.php" role="php" />
<file baseinstalldir="/" md5sum="88c995d09b02a874534b5bcaa444b1c3" name="Image/Barcode2/Driver.php" role="php" />
<file baseinstalldir="/" md5sum="58e9d68c0520ac966142e72e11062cc7" name="Image/Barcode2/DualHeight.php" role="php" />
<file baseinstalldir="/" md5sum="fdacf46fd1110db6fdc0b9e691ecc657" name="Image/Barcode2/DualWidth.php" role="php" />
<file baseinstalldir="/" md5sum="6cbf1131e9cc0a59dd57342c8e57f67c" name="Image/Barcode2/Ean8.php" role="php" />
<file baseinstalldir="/" md5sum="87e5205845e3b098e20a78085f4e9ff5" name="Image/Barcode2/Ean13.php" role="php" />
<file baseinstalldir="/" md5sum="3b8b67864d9c2517ea0e5d9a0782f8f0" name="Image/Barcode2/Driver/Ean8.php" role="php" />
<file baseinstalldir="/" md5sum="46c3346b7abbcbb94276a38e4fa51da5" name="Image/Barcode2/Driver/Ean13.php" role="php" />
<file baseinstalldir="/" md5sum="a2573bce6b7186e048b50030f77e6b04" name="Image/Barcode2/Exception.php" role="php" />
<file baseinstalldir="/" md5sum="e31513127d2ebc1d4484e2dd35e94b23" name="Image/Barcode2/Int25.php" role="php" />
<file baseinstalldir="/" md5sum="75db1c75bb8293401c639a3c364632a1" name="Image/Barcode2/Postnet.php" role="php" />
<file baseinstalldir="/" md5sum="addf8a507d269a64485777799271ac28" name="Image/Barcode2/Upca.php" role="php" />
<file baseinstalldir="/" md5sum="a6ebc5a274d671b2721a431e3275a654" name="Image/Barcode2/Driver/Int25.php" role="php" />
<file baseinstalldir="/" md5sum="8ed1789ad0e51f25eaef7afeb06a64c5" name="Image/Barcode2/Driver/Postnet.php" role="php" />
<file baseinstalldir="/" md5sum="05d72da9584ea6d054a0fe77525e4700" name="Image/Barcode2/Driver/Upca.php" role="php" />
<file baseinstalldir="/" md5sum="d490c6a2cd3e2daf4c2dc8ed21b2358e" name="Image/Barcode2/Writer.php" role="php" />
<file baseinstalldir="/" md5sum="1abec4811830a7cbfcd357eaf2089964" name="tests/Image_Barcode2Test.php" role="test" />
<file baseinstalldir="/" md5sum="4599d66d9092baec4286443e1a6d678e" name="build.xml" role="data" />
Expand Down

0 comments on commit d57dd5b

Please sign in to comment.