smiley 2 лет назад
Родитель
Сommit
8e72bc6521

+ 1 - 1
examples/svgWithLogoAndCustomShapes.php

@@ -79,7 +79,7 @@ class QRSvgWithLogoAndCustomShapes extends QRMarkupSVG{
 	 */
 	protected function getFinderPatterns():string{
 
-		$qz  = $this->options->addQuietzone ? $this->options->quietzoneSize : 0;
+		$qz  = ($this->options->addQuietzone) ? $this->options->quietzoneSize : 0;
 		// the positions for the finder patterns (top left corner)
 		// $this->moduleCount includes 2* the quiet zone size already, so we need to take this into account
 		$pos = [

+ 2 - 2
src/Common/GF256.php

@@ -136,7 +136,7 @@ final class GF256{
 			throw new QRCodeException('$a === 0');
 		}
 
-		return self::expTable[256 - self::logTable[$a] - 1];
+		return self::expTable[(256 - self::logTable[$a] - 1)];
 	}
 
 	/**
@@ -148,7 +148,7 @@ final class GF256{
 			return 0;
 		}
 
-		return self::expTable[(self::logTable[$a] + self::logTable[$b]) % 255];
+		return self::expTable[((self::logTable[$a] + self::logTable[$b]) % 255)];
 	}
 
 }

+ 2 - 2
src/Data/AlphaNum.php

@@ -78,8 +78,8 @@ final class AlphaNum extends QRDataModeAbstract{
 		;
 
 		// encode 2 characters in 11 bits
-		for($i = 0; $i + 1 < $len; $i += 2){
-			$bitBuffer->put(self::CHAR_TO_ORD[$this->data[$i]] * 45 + self::CHAR_TO_ORD[$this->data[$i + 1]], 11);
+		for($i = 0; ($i + 1) < $len; $i += 2){
+			$bitBuffer->put((self::CHAR_TO_ORD[$this->data[$i]] * 45 + self::CHAR_TO_ORD[$this->data[($i + 1)]]), 11);
 		}
 
 		// encode a remaining character in 6 bits

+ 16 - 8
src/Detector/Detector.php

@@ -329,14 +329,22 @@ final class Detector{
 		}
 
 		return (new PerspectiveTransform)->quadrilateralToQuadrilateral(
-			3.5, 3.5,
-			$dimMinusThree, 3.5,
-			$sourceBottomRightX, $sourceBottomRightY,
-			3.5, $dimMinusThree,
-			$nw->getX(), $nw->getY(),
-			$ne->getX(), $ne->getY(),
-			$bottomRightX, $bottomRightY,
-			$sw->getX(), $sw->getY()
+			3.5,
+			3.5,
+			$dimMinusThree,
+			3.5,
+			$sourceBottomRightX,
+			$sourceBottomRightY,
+			3.5,
+			$dimMinusThree,
+			$nw->getX(),
+			$nw->getY(),
+			$ne->getX(),
+			$ne->getY(),
+			$bottomRightX,
+			$bottomRightY,
+			$sw->getX(),
+			$sw->getY()
 		);
 	}
 

+ 5 - 5
src/Detector/GridSampler.php

@@ -134,15 +134,15 @@ final class GridSampler{
 		}
 
 		$bits   = new BitMatrix($dimension);
-		$points = array_fill(0, 2 * $dimension, 0.0);
+		$points = array_fill(0, (2 * $dimension), 0.0);
 
 		for($y = 0; $y < $dimension; $y++){
 			$max    = count($points);
-			$iValue = $y + 0.5;
+			$iValue = ($y + 0.5);
 
 			for($x = 0; $x < $max; $x += 2){
-				$points[$x]     = ($x / 2) + 0.5;
-				$points[$x + 1] = $iValue;
+				$points[$x]       = (($x / 2) + 0.5);
+				$points[($x + 1)] = $iValue;
 			}
 
 			$transform->transformPoints($points);
@@ -153,7 +153,7 @@ final class GridSampler{
 			try{
 				for($x = 0; $x < $max; $x += 2){
 					// Black(-ish) pixel
-					$bits->set($x / 2, $y, $matrix->check((int)$points[$x], (int)$points[$x + 1]), QRMatrix::M_DATA);
+					$bits->set(($x / 2), $y, $matrix->check((int)$points[$x], (int)$points[($x + 1)]), QRMatrix::M_DATA);
 				}
 			}
 			// @codeCoverageIgnoreStart