@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | for($row = 0; $row < $this->pixelCount; $row++){ |
| 253 | 253 | for($col = 0; $col < $this->pixelCount - 6; $col++){ |
| 254 | 254 | if( |
| 255 | - $this->matrix[$row][$col ] |
|
| 255 | + $this->matrix[$row][$col ] |
|
| 256 | 256 | && !$this->matrix[$row][$col + 1] |
| 257 | 257 | && $this->matrix[$row][$col + 2] |
| 258 | 258 | && $this->matrix[$row][$col + 3] |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | for($col = 0; $col < $this->pixelCount; $col++){ |
| 269 | 269 | for($row = 0; $row < $this->pixelCount - 6; $row++){ |
| 270 | 270 | if( |
| 271 | - $this->matrix[$row ][$col] |
|
| 271 | + $this->matrix[$row ][$col] |
|
| 272 | 272 | && !$this->matrix[$row + 1][$col] |
| 273 | 273 | && $this->matrix[$row + 2][$col] |
| 274 | 274 | && $this->matrix[$row + 3][$col] |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | const ERROR_CORRECT_LEVEL_H = 2; // 30%. |
| 42 | 42 | |
| 43 | 43 | // max bits @ ec level L:07 M:15 Q:25 H:30 % |
| 44 | - const TYPE_01 = 1; // 152 128 104 72 |
|
| 45 | - const TYPE_02 = 2; // 272 224 176 128 |
|
| 46 | - const TYPE_03 = 3; // 440 352 272 208 |
|
| 47 | - const TYPE_04 = 4; // 640 512 384 288 |
|
| 48 | - const TYPE_05 = 5; // 864 688 496 368 |
|
| 49 | - const TYPE_06 = 6; // 1088 864 608 480 |
|
| 50 | - const TYPE_07 = 7; // 1248 992 704 528 |
|
| 51 | - const TYPE_08 = 8; // 1552 1232 880 688 |
|
| 52 | - const TYPE_09 = 9; // 1856 1456 1056 800 |
|
| 44 | + const TYPE_01 = 1; // 152 128 104 72 |
|
| 45 | + const TYPE_02 = 2; // 272 224 176 128 |
|
| 46 | + const TYPE_03 = 3; // 440 352 272 208 |
|
| 47 | + const TYPE_04 = 4; // 640 512 384 288 |
|
| 48 | + const TYPE_05 = 5; // 864 688 496 368 |
|
| 49 | + const TYPE_06 = 6; // 1088 864 608 480 |
|
| 50 | + const TYPE_07 = 7; // 1248 992 704 528 |
|
| 51 | + const TYPE_08 = 8; // 1552 1232 880 688 |
|
| 52 | + const TYPE_09 = 9; // 1856 1456 1056 800 |
|
| 53 | 53 | const TYPE_10 = 10; // 2192 1728 1232 976 |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | $count = 0; |
| 234 | 234 | |
| 235 | 235 | if( |
| 236 | - $this->matrix[$row ][$col ] |
|
| 237 | - || $this->matrix[$row ][$col + 1] |
|
| 238 | - || $this->matrix[$row + 1][$col ] |
|
| 236 | + $this->matrix[$row][$col] |
|
| 237 | + || $this->matrix[$row][$col + 1] |
|
| 238 | + || $this->matrix[$row + 1][$col] |
|
| 239 | 239 | || $this->matrix[$row + 1][$col + 1] |
| 240 | 240 | ){ |
| 241 | 241 | $count++; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | for($row = 0; $row < $this->pixelCount; $row++){ |
| 253 | 253 | for($col = 0; $col < $this->pixelCount - 6; $col++){ |
| 254 | 254 | if( |
| 255 | - $this->matrix[$row][$col ] |
|
| 255 | + $this->matrix[$row][$col] |
|
| 256 | 256 | && !$this->matrix[$row][$col + 1] |
| 257 | 257 | && $this->matrix[$row][$col + 2] |
| 258 | 258 | && $this->matrix[$row][$col + 3] |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | for($col = 0; $col < $this->pixelCount; $col++){ |
| 269 | 269 | for($row = 0; $row < $this->pixelCount - 6; $row++){ |
| 270 | 270 | if( |
| 271 | - $this->matrix[$row ][$col] |
|
| 271 | + $this->matrix[$row][$col] |
|
| 272 | 272 | && !$this->matrix[$row + 1][$col] |
| 273 | 273 | && $this->matrix[$row + 2][$col] |
| 274 | 274 | && $this->matrix[$row + 3][$col] |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $a = (int)floor($i / 3); |
| 317 | 317 | $b = $i % 3 + $this->pixelCount - 8 - 3; |
| 318 | 318 | |
| 319 | - $this->matrix[$a][$b] = $this->matrix[$b][$a] = !$test && (($bits >> $i) & 1) === 1; |
|
| 319 | + $this->matrix[$a][$b] = $this->matrix[$b][$a] = !$test && (($bits >> $i)&1) === 1; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | } |
@@ -327,13 +327,13 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | protected function setTypeInfo($test, $pattern){ |
| 329 | 329 | $this->setPattern(); |
| 330 | - $bits = Util::getBCHTypeInfo(($this->errorCorrectLevel << 3) | $pattern); |
|
| 330 | + $bits = Util::getBCHTypeInfo(($this->errorCorrectLevel << 3)|$pattern); |
|
| 331 | 331 | |
| 332 | 332 | for($i = 0; $i < 15; $i++){ |
| 333 | - $mod = !$test && (($bits >> $i) & 1) === 1; |
|
| 333 | + $mod = !$test && (($bits >> $i)&1) === 1; |
|
| 334 | 334 | |
| 335 | 335 | switch(true){ |
| 336 | - case $i < 6:$this->matrix[$i ][8] = $mod; break; |
|
| 336 | + case $i < 6:$this->matrix[$i][8] = $mod; break; |
|
| 337 | 337 | case $i < 8:$this->matrix[$i + 1][8] = $mod; break; |
| 338 | 338 | default: |
| 339 | 339 | $this->matrix[$this->pixelCount - 15 + $i][8] = $mod; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | switch(true){ |
| 343 | 343 | case $i < 8:$this->matrix[8][$this->pixelCount - $i - 1] = $mod; break; |
| 344 | - case $i < 9:$this->matrix[8][ 15 + 1 - $i - 1] = $mod; break; |
|
| 344 | + case $i < 9:$this->matrix[8][15 + 1 - $i - 1] = $mod; break; |
|
| 345 | 345 | default: |
| 346 | 346 | $this->matrix[8][15 - $i - 1] = $mod; |
| 347 | 347 | } |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | foreach($dcdata[$key] as $i => &$_dcdata){ |
| 425 | 425 | $bdata = $this->bitBuffer->buffer; |
| 426 | - $_dcdata = 0xff & $bdata[$i + $offset]; |
|
| 426 | + $_dcdata = 0xff&$bdata[$i + $offset]; |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | $offset += $rsBlockDataCount; |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | $dark = false; |
| 499 | 499 | |
| 500 | 500 | if($byteIndex < $dataCount){ |
| 501 | - $dark = (($data[$byteIndex] >> $bitIndex) & 1) === 1; |
|
| 501 | + $dark = (($data[$byteIndex] >> $bitIndex)&1) === 1; |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | $a = $row + $_col; |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | $this->matrix[$posI + $row][$posJ + $col] = |
| 585 | 585 | $row === -2 || $row === 2 |
| 586 | 586 | || $col === -2 || $col === 2 |
| 587 | - ||($row === 0 && $col === 0); |
|
| 587 | + ||($row === 0 && $col === 0); |
|
| 588 | 588 | } |
| 589 | 589 | } |
| 590 | 590 | |
@@ -21,11 +21,12 @@ |
||
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @param \chillerlan\QRCode\BitBuffer $buffer |
| 24 | + * @return void |
|
| 24 | 25 | */ |
| 25 | 26 | public function write(BitBuffer &$buffer); |
| 26 | 27 | |
| 27 | 28 | /** |
| 28 | - * @param $type |
|
| 29 | + * @param integer $type |
|
| 29 | 30 | * |
| 30 | 31 | * @return int |
| 31 | 32 | * @throws \chillerlan\QRCode\Data\QRCodeDataException |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | /** |
| 23 | 23 | * @param \chillerlan\QRCode\BitBuffer $buffer |
| 24 | 24 | */ |
| 25 | - public function write(BitBuffer &$buffer); |
|
| 25 | + public function write(BitBuffer&$buffer); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @param $type |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * @return mixed |
|
| 62 | + * @return string |
|
| 63 | 63 | * @throws \chillerlan\QRCode\Output\QRCodeOutputException |
| 64 | 64 | */ |
| 65 | 65 | public function dump(){ |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $this->options->pixelSize = max(1, min(25, (int)$this->options->pixelSize)); |
| 39 | 39 | $this->options->marginSize = max(0, min(25, (int)$this->options->marginSize)); |
| 40 | 40 | |
| 41 | - foreach(['fgRed', 'fgGreen', 'fgBlue', 'bgRed', 'bgGreen', 'bgBlue',] as $val){ |
|
| 41 | + foreach(['fgRed', 'fgGreen', 'fgBlue', 'bgRed', 'bgGreen', 'bgBlue', ] as $val){ |
|
| 42 | 42 | $this->options->{$val} = max(0, min(255, (int)$this->options->{$val})); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | for($c = 0; $c < $this->pixelCount; $c++){ |
| 79 | 79 | if($this->matrix[$r][$c]){ |
| 80 | 80 | imagefilledrectangle($image, |
| 81 | - $this->options->marginSize + $c * $this->options->pixelSize, |
|
| 82 | - $this->options->marginSize + $r * $this->options->pixelSize, |
|
| 81 | + $this->options->marginSize + $c * $this->options->pixelSize, |
|
| 82 | + $this->options->marginSize + $r * $this->options->pixelSize, |
|
| 83 | 83 | $this->options->marginSize + ($c + 1) * $this->options->pixelSize - 1, |
| 84 | 84 | $this->options->marginSize + ($r + 1) * $this->options->pixelSize - 1, |
| 85 | 85 | $foreground); |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | ob_start(); |
| 91 | 91 | |
| 92 | 92 | switch($this->options->type){ |
| 93 | - case QRCode::OUTPUT_IMAGE_PNG: imagepng ($image, $this->options->cachefile, (int)$this->options->pngCompression); break; |
|
| 93 | + case QRCode::OUTPUT_IMAGE_PNG: imagepng($image, $this->options->cachefile, (int)$this->options->pngCompression); break; |
|
| 94 | 94 | case QRCode::OUTPUT_IMAGE_JPG: imagejpeg($image, $this->options->cachefile, (int)$this->options->jpegQuality); break; |
| 95 | - case QRCode::OUTPUT_IMAGE_GIF: imagegif ($image, $this->options->cachefile); break; /** Actually, it's pronounced "DJIFF". *hides* */ |
|
| 95 | + case QRCode::OUTPUT_IMAGE_GIF: imagegif($image, $this->options->cachefile); break; /** Actually, it's pronounced "DJIFF". *hides* */ |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $imageData = ob_get_contents(); |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | namespace chillerlan\QRCodeTest\Data; |
| 12 | 12 | |
| 13 | 13 | use chillerlan\QRCode\BitBuffer; |
| 14 | -use chillerlan\QRCode\QRConst; |
|
| 15 | 14 | use chillerlan\QRCode\Data\AlphaNum; |
| 16 | 15 | use chillerlan\QRCode\Data\Byte; |
| 17 | 16 | use chillerlan\QRCode\Data\Kanji; |
| 18 | 17 | use chillerlan\QRCode\Data\Number; |
| 18 | +use chillerlan\QRCode\QRConst; |
|
| 19 | 19 | |
| 20 | 20 | class DataTest extends \PHPUnit_Framework_TestCase{ |
| 21 | 21 | |
@@ -11,11 +11,11 @@ |
||
| 11 | 11 | |
| 12 | 12 | namespace chillerlan\QRCodeTest; |
| 13 | 13 | |
| 14 | +use ReflectionClass; |
|
| 14 | 15 | use chillerlan\QRCode\Output\QRString; |
| 15 | 16 | use chillerlan\QRCode\QRCode; |
| 16 | 17 | use chillerlan\QRCode\QRConst; |
| 17 | 18 | use chillerlan\QRCode\QROptions; |
| 18 | -use ReflectionClass; |
|
| 19 | 19 | |
| 20 | 20 | class QRCodeTest extends \PHPUnit_Framework_TestCase{ |
| 21 | 21 | |
@@ -86,21 +86,21 @@ |
||
| 86 | 86 | |
| 87 | 87 | public function getTypeNumberDataProvider(){ |
| 88 | 88 | return [ |
| 89 | - [true, QRCode::TYPE_05, 'foobar'], |
|
| 89 | + [true, QRCode::TYPE_05, 'foobar'], |
|
| 90 | 90 | [false, QRCode::TYPE_05, 'foobar'], |
| 91 | - [true, QRCode::TYPE_10, 'foobar'], |
|
| 91 | + [true, QRCode::TYPE_10, 'foobar'], |
|
| 92 | 92 | [false, QRCode::TYPE_10, 'foobar'], |
| 93 | - [true, QRCode::TYPE_05, '1234567890'], |
|
| 93 | + [true, QRCode::TYPE_05, '1234567890'], |
|
| 94 | 94 | [false, QRCode::TYPE_05, '1234567890'], |
| 95 | - [true, QRCode::TYPE_10, '1234567890'], |
|
| 95 | + [true, QRCode::TYPE_10, '1234567890'], |
|
| 96 | 96 | [false, QRCode::TYPE_10, '1234567890'], |
| 97 | - [true, QRCode::TYPE_05, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
|
| 97 | + [true, QRCode::TYPE_05, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
|
| 98 | 98 | [false, QRCode::TYPE_05, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
| 99 | - [true, QRCode::TYPE_10, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
|
| 99 | + [true, QRCode::TYPE_10, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
|
| 100 | 100 | [false, QRCode::TYPE_10, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 $%*+-./:'], |
| 101 | - [true, QRCode::TYPE_05, '茗荷'], |
|
| 101 | + [true, QRCode::TYPE_05, '茗荷'], |
|
| 102 | 102 | [false, QRCode::TYPE_05, '茗荷'], |
| 103 | - [true, QRCode::TYPE_10, '茗荷'], |
|
| 103 | + [true, QRCode::TYPE_10, '茗荷'], |
|
| 104 | 104 | [false, QRCode::TYPE_10, '茗荷'], |
| 105 | 105 | ]; |
| 106 | 106 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | /** |
| 46 | 46 | * @param \chillerlan\QRCode\BitBuffer $buffer |
| 47 | 47 | */ |
| 48 | - public function write(BitBuffer &$buffer){ |
|
| 48 | + public function write(BitBuffer&$buffer){ |
|
| 49 | 49 | $i = 0; |
| 50 | 50 | |
| 51 | 51 | while($i + 1 < $this->dataLength){ |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | /** |
| 34 | 34 | * @param \chillerlan\QRCode\BitBuffer $buffer |
| 35 | 35 | */ |
| 36 | - public function write(BitBuffer &$buffer){ |
|
| 36 | + public function write(BitBuffer&$buffer){ |
|
| 37 | 37 | for($i = 0; $i < $this->dataLength; $i++){ |
| 38 | 38 | $buffer->put(ord($this->data[$i]), 8); |
| 39 | 39 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | * |
| 36 | 36 | * @throws \chillerlan\QRCode\Data\QRCodeDataException |
| 37 | 37 | */ |
| 38 | - public function write(BitBuffer &$buffer){ |
|
| 38 | + public function write(BitBuffer&$buffer){ |
|
| 39 | 39 | |
| 40 | 40 | $i = 0; |
| 41 | 41 | while($i + 1 < $this->dataLength){ |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | /** |
| 34 | 34 | * @param \chillerlan\QRCode\BitBuffer $buffer |
| 35 | 35 | */ |
| 36 | - public function write(BitBuffer &$buffer){ |
|
| 36 | + public function write(BitBuffer&$buffer){ |
|
| 37 | 37 | $i = 0; |
| 38 | 38 | |
| 39 | 39 | while($i + 2 < $this->dataLength){ |