web/lib/Zend/Barcode/Object/Code128.php
changeset 886 1e110b03ae96
parent 807 877f952ae2bd
child 1230 68c69c656a2c
--- a/web/lib/Zend/Barcode/Object/Code128.php	Sun Apr 21 10:07:03 2013 +0200
+++ b/web/lib/Zend/Barcode/Object/Code128.php	Sun Apr 21 21:54:24 2013 +0200
@@ -15,7 +15,7 @@
  * @category   Zend
  * @package    Zend_Barcode
  * @subpackage Object
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  * @version    $Id: Code25.php 20096 2010-01-06 02:05:09Z bkarwin $
  */
@@ -35,7 +35,7 @@
  *
  * @category   Zend
  * @package    Zend_Barcode
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Barcode_Object_Code128 extends Zend_Barcode_Object_ObjectAbstract
@@ -48,9 +48,9 @@
     protected $_withChecksum = true;
 
     /**
-	 * @var array
-	 */
-	protected $_convertedText = array();
+     * @var array
+     */
+    protected $_convertedText = array();
 
     protected $_codingMap = array(
                  0 => "11011001100",   1 => "11001101100",   2 => "11001100110",
@@ -192,7 +192,7 @@
         $characterLength = 11 * $this->_barThinWidth * $this->_factor;
         $convertedChars = count($this->_convertToBarcodeChars($this->getText()));
         if ($this->_withChecksum) {
-        	$convertedChars++;
+            $convertedChars++;
         }
         $encodedData = $convertedChars * $characterLength;
         // ...except the STOP character (13)
@@ -220,7 +220,7 @@
         $convertedChars = $this->_convertToBarcodeChars($this->getText());
 
         if ($this->_withChecksum) {
-        	$convertedChars[] = $this->getChecksum($this->getText());
+            $convertedChars[] = $this->getChecksum($this->getText());
         }
 
         // STOP CHARACTER
@@ -229,7 +229,7 @@
         foreach ($convertedChars as $barcodeChar) {
             $barcodePattern = $this->_codingMap[$barcodeChar];
             foreach (str_split($barcodePattern) as $c) {
-                $barcodeTable[] = array($c, 1, 0, 1);
+                $barcodeTable[] = array($c, $this->_barThinWidth, 0, 1);
             }
         }
         return $barcodeTable;
@@ -238,24 +238,24 @@
     /**
      * Checks if the next $length chars of $string starting at $pos are numeric.
      * Returns false if the end of the string is reached.
-     * @param $string String to search
-     * @param $pos Starting position
-     * @param $length Length to search
+     * @param string $string String to search
+     * @param int    $pos Starting position
+     * @param int    $length Length to search
      * @return bool
      */
     protected static function _isDigit($string, $pos, $length = 2)
     {
-	    if ($pos + $length > strlen($string)) {
-	       return false;
-	    }
+        if ($pos + $length > strlen($string)) {
+           return false;
+        }
 
-		for ($i = $pos; $i < $pos + $length; $i++) {
-		      if (!is_numeric($string[$i])) {
-		          return false;
-		      }
-		}
-		return true;
-	}
+        for ($i = $pos; $i < $pos + $length; $i++) {
+              if (!is_numeric($string[$i])) {
+                  return false;
+              }
+        }
+        return true;
+    }
 
     /**
      * Convert string to barcode string
@@ -263,14 +263,14 @@
      */
     protected function _convertToBarcodeChars($string)
     {
-    	$string = (string) $string;
-    	if (!strlen($string)) {
-    		return array();
-    	}
+        $string = (string) $string;
+        if (!strlen($string)) {
+            return array();
+        }
 
-    	if (isset($this->_convertedText[md5($string)])) {
-    		return $this->_convertedText[md5($string)];
-    	}
+        if (isset($this->_convertedText[md5($string)])) {
+            return $this->_convertedText[md5($string)];
+        }
 
         $currentCharset = null;
         $sum = 0;
@@ -363,17 +363,17 @@
      */
     public function getChecksum($text)
     {
-    	$tableOfChars = $this->_convertToBarcodeChars($text);
+        $tableOfChars = $this->_convertToBarcodeChars($text);
 
-    	$sum = $tableOfChars[0];
-    	unset($tableOfChars[0]);
+        $sum = $tableOfChars[0];
+        unset($tableOfChars[0]);
 
-    	$k = 1;
-    	foreach ($tableOfChars as $char) {
-    		$sum += ($k++) * $char;
-    	}
+        $k = 1;
+        foreach ($tableOfChars as $char) {
+            $sum += ($k++) * $char;
+        }
 
-    	$checksum = $sum % 103;
+        $checksum = $sum % 103;
 
         return $checksum;
     }
@@ -385,7 +385,7 @@
      */
     protected function _validateText($value, $options = array())
     {
-    	// @TODO: add code128 validator
-    	return true;
+        // @TODO: add code128 validator
+        return true;
     }
-}
\ No newline at end of file
+}