Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Issue #3 PHPCS

  • Loading branch information...
commit a3bc58e11838f23a9d269a7f7991e757664506e6 1 parent eecac94
Daniel O'Connor authored

Showing 1 changed file with 51 additions and 17 deletions. Show diff stats Hide diff stats

  1. +51 17 Image/Barcode2/code128.php
68 Image/Barcode2/code128.php
@@ -42,6 +42,16 @@
42 42 * @link http://pear.php.net/package/Image_Barcode2
43 43 */
44 44
  45 +/**
  46 + * Code128
  47 + *
  48 + * @category Image
  49 + * @package Image_Barcode2
  50 + * @author Jeffrey K. Brown <jkb@darkfantastic.net>
  51 + * @copyright 2005 The PHP Group
  52 + * @license http://www.php.net/license/3_0.txt PHP License 3.0
  53 + * @link http://pear.php.net/package/Image_Barcode2
  54 + */
45 55
46 56 class Image_Barcode2_code128
47 57 {
@@ -54,7 +64,7 @@ class Image_Barcode2_code128
54 64 /**
55 65 * Draws a Code128 image barcode
56 66 *
57   - * @param string $text A text that should be in the image barcode
  67 + * @param string $text A text that should be in the image barcode
58 68 *
59 69 * @return image The corresponding interleaved 2 of 5 image barcode
60 70 *
@@ -131,14 +141,19 @@ public function draw($text)
131 141 $nval = $allbars[$i];
132 142 $barcodewidth += ($nval * $this->_barwidth);
133 143 }
134   - $barcodelongheight = (int) (imagefontheight($this->_font) / 2) + $this->_barcodeheight;
  144 +
  145 + $barcodelongheight = (int) (imagefontheight($this->_font) / 2)
  146 + + $this->_barcodeheight;
135 147
136 148
137 149 // Then, we create the image, allocate the colors, and fill
138 150 // the image with a nice, white background, ready for printing
139 151 // our black bars and the text.
140 152
141   - $img = imagecreate($barcodewidth, $barcodelongheight + imagefontheight($this->_font)+1);
  153 + $img = imagecreate(
  154 + $barcodewidth,
  155 + $barcodelongheight + imagefontheight($this->_font) + 1
  156 + );
142 157 $black = imagecolorallocate($img, 0, 0, 0);
143 158 $white = imagecolorallocate($img, 255, 255, 255);
144 159 imagefill($img, 0, 0, $white);
@@ -172,7 +187,14 @@ public function draw($text)
172 187 $width = $nval * $this->_barwidth;
173 188
174 189 if ($bar == 1) {
175   - imagefilledrectangle($img, $xpos, 0, $xpos + $width - 1, $barcodelongheight, $black);
  190 + imagefilledrectangle(
  191 + $img,
  192 + $xpos,
  193 + 0,
  194 + $xpos + $width - 1,
  195 + $barcodelongheight,
  196 + $black
  197 + );
176 198 $xpos += $width;
177 199 $bar = 0;
178 200 } else {
@@ -186,11 +208,10 @@ public function draw($text)
186 208
187 209
188 210 /**
189   - * @internal
190   - * In the Image_Barcode2_code128 constructor, we initialize
191   - * the $code array, containing the bar and space pattern
192   - * for the Code128 B character set.
193   - */
  211 + * In the Image_Barcode2_code128 constructor, we initialize
  212 + * the $code array, containing the bar and space pattern
  213 + * for the Code128 B character set.
  214 + */
194 215 public function __construct()
195 216 {
196 217 $this->_code[0] = "212222"; // " "
@@ -300,8 +321,11 @@ public function __construct()
300 321
301 322
302 323 /**
303   - * @param string $char
304   - * @return the Code128 code for a character
  324 + * Get the Code128 code for a character
  325 + *
  326 + * @param string $char Chacter
  327 + *
  328 + * @return string
305 329 */
306 330 private function _getCharCode($char)
307 331 {
@@ -310,7 +334,9 @@ private function _getCharCode($char)
310 334
311 335
312 336 /**
313   - * @return the Start Code for Code128
  337 + * Get the Start Code for Code128
  338 + *
  339 + * @return string
314 340 */
315 341 private function _getStartCode()
316 342 {
@@ -319,7 +345,9 @@ private function _getStartCode()
319 345
320 346
321 347 /**
322   - * @return the Stop Code for Code128
  348 + * Get the Stop Code for Code128
  349 + *
  350 + * @return string
323 351 */
324 352 private function _getStopCode()
325 353 {
@@ -328,8 +356,11 @@ private function _getStopCode()
328 356
329 357
330 358 /**
331   - * @param int $index
332   - * @return the Code128 code equivalent of a character number
  359 + * Rhe Code128 code equivalent of a character number
  360 + *
  361 + * @param int $index Index
  362 + *
  363 + * @return string
333 364 */
334 365 private function _getNumCode($index)
335 366 {
@@ -338,8 +369,11 @@ private function _getNumCode($index)
338 369
339 370
340 371 /**
341   - * @param string $char
342   - * @return int the Code128 numerical equivalent of a character.
  372 + * Get the Code128 numerical equivalent of a character.
  373 + *
  374 + * @param string $char Character
  375 + *
  376 + * @return int
343 377 */
344 378 private function _getCharNumber($char)
345 379 {

0 comments on commit a3bc58e

Please sign in to comment.
Something went wrong with that request. Please try again.