@@ -40,7 +40,7 @@ |
||
| 40 | 40 | ImagePng($image, $filename); |
| 41 | 41 | header("Content-type: image/png"); |
| 42 | 42 | ImagePng($image); |
| 43 | - }else{ |
|
| 43 | + } else{ |
|
| 44 | 44 | ImagePng($image, $filename); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -37,12 +37,24 @@ |
||
| 37 | 37 | public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) |
| 38 | 38 | { |
| 39 | 39 | foreach(self::$items as $rs) { |
| 40 | - if($rs->pad != $pad) continue; |
|
| 41 | - if($rs->nroots != $nroots) continue; |
|
| 42 | - if($rs->mm != $symsize) continue; |
|
| 43 | - if($rs->gfpoly != $gfpoly) continue; |
|
| 44 | - if($rs->fcr != $fcr) continue; |
|
| 45 | - if($rs->prim != $prim) continue; |
|
| 40 | + if($rs->pad != $pad) { |
|
| 41 | + continue; |
|
| 42 | + } |
|
| 43 | + if($rs->nroots != $nroots) { |
|
| 44 | + continue; |
|
| 45 | + } |
|
| 46 | + if($rs->mm != $symsize) { |
|
| 47 | + continue; |
|
| 48 | + } |
|
| 49 | + if($rs->gfpoly != $gfpoly) { |
|
| 50 | + continue; |
|
| 51 | + } |
|
| 52 | + if($rs->fcr != $fcr) { |
|
| 53 | + continue; |
|
| 54 | + } |
|
| 55 | + if($rs->prim != $prim) { |
|
| 56 | + continue; |
|
| 57 | + } |
|
| 46 | 58 | |
| 47 | 59 | return $rs; |
| 48 | 60 | } |
@@ -108,8 +108,9 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) { |
| 110 | 110 | $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level]; |
| 111 | - if($words >= $size) |
|
| 112 | - return $i; |
|
| 111 | + if($words >= $size) { |
|
| 112 | + return $i; |
|
| 113 | + } |
|
| 113 | 114 | } |
| 114 | 115 | |
| 115 | 116 | return -1; |
@@ -127,8 +128,9 @@ discard block |
||
| 127 | 128 | //---------------------------------------------------------------------- |
| 128 | 129 | public static function lengthIndicator($mode, $version) |
| 129 | 130 | { |
| 130 | - if ($mode == QR_MODE_STRUCTURE) |
|
| 131 | - return 0; |
|
| 131 | + if ($mode == QR_MODE_STRUCTURE) { |
|
| 132 | + return 0; |
|
| 133 | + } |
|
| 132 | 134 | |
| 133 | 135 | if ($version <= 9) { |
| 134 | 136 | $l = 0; |
@@ -144,8 +146,9 @@ discard block |
||
| 144 | 146 | //---------------------------------------------------------------------- |
| 145 | 147 | public static function maximumWords($mode, $version) |
| 146 | 148 | { |
| 147 | - if($mode == QR_MODE_STRUCTURE) |
|
| 148 | - return 3; |
|
| 149 | + if($mode == QR_MODE_STRUCTURE) { |
|
| 150 | + return 3; |
|
| 151 | + } |
|
| 149 | 152 | |
| 150 | 153 | if($version <= 9) { |
| 151 | 154 | $l = 0; |
@@ -291,8 +294,9 @@ discard block |
||
| 291 | 294 | //---------------------------------------------------------------------- |
| 292 | 295 | public static function putAlignmentPattern($version, &$frame, $width) |
| 293 | 296 | { |
| 294 | - if($version < 2) |
|
| 295 | - return; |
|
| 297 | + if($version < 2) { |
|
| 298 | + return; |
|
| 299 | + } |
|
| 296 | 300 | |
| 297 | 301 | $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0]; |
| 298 | 302 | if($d < 0) { |
@@ -344,8 +348,9 @@ discard block |
||
| 344 | 348 | //---------------------------------------------------------------------- |
| 345 | 349 | public static function getVersionPattern($version) |
| 346 | 350 | { |
| 347 | - if($version < 7 || $version > QRSPEC_VERSION_MAX) |
|
| 348 | - return 0; |
|
| 351 | + if($version < 7 || $version > QRSPEC_VERSION_MAX) { |
|
| 352 | + return 0; |
|
| 353 | + } |
|
| 349 | 354 | |
| 350 | 355 | return self::$versionPattern[$version -7]; |
| 351 | 356 | } |
@@ -362,11 +367,13 @@ discard block |
||
| 362 | 367 | |
| 363 | 368 | public static function getFormatInfo($mask, $level) |
| 364 | 369 | { |
| 365 | - if($mask < 0 || $mask > 7) |
|
| 366 | - return 0; |
|
| 370 | + if($mask < 0 || $mask > 7) { |
|
| 371 | + return 0; |
|
| 372 | + } |
|
| 367 | 373 | |
| 368 | - if($level < 0 || $level > 3) |
|
| 369 | - return 0; |
|
| 374 | + if($level < 0 || $level > 3) { |
|
| 375 | + return 0; |
|
| 376 | + } |
|
| 370 | 377 | |
| 371 | 378 | return self::$formatInfo[$level][$mask]; |
| 372 | 379 | } |
@@ -546,8 +553,9 @@ discard block |
||
| 546 | 553 | //---------------------------------------------------------------------- |
| 547 | 554 | public static function newFrame($version) |
| 548 | 555 | { |
| 549 | - if($version < 1 || $version > QRSPEC_VERSION_MAX) |
|
| 550 | - return null; |
|
| 556 | + if($version < 1 || $version > QRSPEC_VERSION_MAX) { |
|
| 557 | + return null; |
|
| 558 | + } |
|
| 551 | 559 | |
| 552 | 560 | if(!isset(self::$frames[$version])) { |
| 553 | 561 | |
@@ -565,8 +573,9 @@ discard block |
||
| 565 | 573 | } |
| 566 | 574 | } |
| 567 | 575 | |
| 568 | - if(is_null(self::$frames[$version])) |
|
| 569 | - return null; |
|
| 576 | + if(is_null(self::$frames[$version])) { |
|
| 577 | + return null; |
|
| 578 | + } |
|
| 570 | 579 | |
| 571 | 580 | return self::$frames[$version]; |
| 572 | 581 | } |
@@ -110,13 +110,15 @@ discard block |
||
| 110 | 110 | //---------------------------------------------------------------------- |
| 111 | 111 | public function appendNum($bits, $num) |
| 112 | 112 | { |
| 113 | - if ($bits == 0) |
|
| 114 | - return 0; |
|
| 113 | + if ($bits == 0) { |
|
| 114 | + return 0; |
|
| 115 | + } |
|
| 115 | 116 | |
| 116 | 117 | $b = QRbitstream::newFromNum($bits, $num); |
| 117 | 118 | |
| 118 | - if(is_null($b)) |
|
| 119 | - return -1; |
|
| 119 | + if(is_null($b)) { |
|
| 120 | + return -1; |
|
| 121 | + } |
|
| 120 | 122 | |
| 121 | 123 | $ret = $this->append($b); |
| 122 | 124 | unset($b); |
@@ -127,13 +129,15 @@ discard block |
||
| 127 | 129 | //---------------------------------------------------------------------- |
| 128 | 130 | public function appendBytes($size, $data) |
| 129 | 131 | { |
| 130 | - if ($size == 0) |
|
| 131 | - return 0; |
|
| 132 | + if ($size == 0) { |
|
| 133 | + return 0; |
|
| 134 | + } |
|
| 132 | 135 | |
| 133 | 136 | $b = QRbitstream::newFromBytes($size, $data); |
| 134 | 137 | |
| 135 | - if(is_null($b)) |
|
| 136 | - return -1; |
|
| 138 | + if(is_null($b)) { |
|
| 139 | + return -1; |
|
| 140 | + } |
|
| 137 | 141 | |
| 138 | 142 | $ret = $this->append($b); |
| 139 | 143 | unset($b); |
@@ -119,8 +119,9 @@ |
||
| 119 | 119 | $err = ob_get_contents(); |
| 120 | 120 | ob_end_clean(); |
| 121 | 121 | |
| 122 | - if ($err != '') |
|
| 123 | - QRtools::log($outfile, $err); |
|
| 122 | + if ($err != '') { |
|
| 123 | + QRtools::log($outfile, $err); |
|
| 124 | + } |
|
| 124 | 125 | |
| 125 | 126 | $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin)); |
| 126 | 127 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | if($filePath){ |
| 44 | 44 | if($filePath === true){ |
| 45 | 45 | $filePath = saveFilePath; |
| 46 | - }else{ |
|
| 46 | + } else{ |
|
| 47 | 47 | if(substr($filePath,-1) != DIRECTORY_SEPARATOR){ |
| 48 | 48 | $filePath .= DIRECTORY_SEPARATOR; |
| 49 | 49 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | if(is_int($data)){ |
| 57 | 57 | $file_name = 'bar'.$data.'.png'; |
| 58 | - }else{ |
|
| 58 | + } else{ |
|
| 59 | 59 | $file_name = 'bar'.date('YmdHis').rand(1111,9999).'.png'; |
| 60 | 60 | } |
| 61 | 61 | $filename = $filePath.$file_name.'.png'; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $drawing->draw(); |
| 65 | 65 | $drawing->finish(BCGDrawing::IMG_FORMAT_PNG); |
| 66 | 66 | return $filename; |
| 67 | - }else{ |
|
| 67 | + } else{ |
|
| 68 | 68 | $drawing = new BCGDrawing(false, $colorBack); |
| 69 | 69 | $drawing->setBarcode($code); |
| 70 | 70 | $drawing->draw(); |