Skip to content

Commit 8e72bc6

Browse files
committed
💄
1 parent 4d48f4b commit 8e72bc6

File tree

5 files changed

+26
-18
lines changed

5 files changed

+26
-18
lines changed

examples/svgWithLogoAndCustomShapes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function module(int $x, int $y, int $M_TYPE):string{
7979
*/
8080
protected function getFinderPatterns():string{
8181

82-
$qz = $this->options->addQuietzone ? $this->options->quietzoneSize : 0;
82+
$qz = ($this->options->addQuietzone) ? $this->options->quietzoneSize : 0;
8383
// the positions for the finder patterns (top left corner)
8484
// $this->moduleCount includes 2* the quiet zone size already, so we need to take this into account
8585
$pos = [

src/Common/GF256.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public static function inverse(int $a):int{
136136
throw new QRCodeException('$a === 0');
137137
}
138138

139-
return self::expTable[256 - self::logTable[$a] - 1];
139+
return self::expTable[(256 - self::logTable[$a] - 1)];
140140
}
141141

142142
/**
@@ -148,7 +148,7 @@ public static function multiply(int $a, int $b):int{
148148
return 0;
149149
}
150150

151-
return self::expTable[(self::logTable[$a] + self::logTable[$b]) % 255];
151+
return self::expTable[((self::logTable[$a] + self::logTable[$b]) % 255)];
152152
}
153153

154154
}

src/Data/AlphaNum.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public function write(BitBuffer $bitBuffer, int $versionNumber):void{
7878
;
7979

8080
// encode 2 characters in 11 bits
81-
for($i = 0; $i + 1 < $len; $i += 2){
82-
$bitBuffer->put(self::CHAR_TO_ORD[$this->data[$i]] * 45 + self::CHAR_TO_ORD[$this->data[$i + 1]], 11);
81+
for($i = 0; ($i + 1) < $len; $i += 2){
82+
$bitBuffer->put((self::CHAR_TO_ORD[$this->data[$i]] * 45 + self::CHAR_TO_ORD[$this->data[($i + 1)]]), 11);
8383
}
8484

8585
// encode a remaining character in 6 bits

src/Detector/Detector.php

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,22 @@ private function createTransform(
329329
}
330330

331331
return (new PerspectiveTransform)->quadrilateralToQuadrilateral(
332-
3.5, 3.5,
333-
$dimMinusThree, 3.5,
334-
$sourceBottomRightX, $sourceBottomRightY,
335-
3.5, $dimMinusThree,
336-
$nw->getX(), $nw->getY(),
337-
$ne->getX(), $ne->getY(),
338-
$bottomRightX, $bottomRightY,
339-
$sw->getX(), $sw->getY()
332+
3.5,
333+
3.5,
334+
$dimMinusThree,
335+
3.5,
336+
$sourceBottomRightX,
337+
$sourceBottomRightY,
338+
3.5,
339+
$dimMinusThree,
340+
$nw->getX(),
341+
$nw->getY(),
342+
$ne->getX(),
343+
$ne->getY(),
344+
$bottomRightX,
345+
$bottomRightY,
346+
$sw->getX(),
347+
$sw->getY()
340348
);
341349
}
342350

src/Detector/GridSampler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@ public function sampleGrid(BitMatrix $matrix, int $dimension, PerspectiveTransfo
134134
}
135135

136136
$bits = new BitMatrix($dimension);
137-
$points = array_fill(0, 2 * $dimension, 0.0);
137+
$points = array_fill(0, (2 * $dimension), 0.0);
138138

139139
for($y = 0; $y < $dimension; $y++){
140140
$max = count($points);
141-
$iValue = $y + 0.5;
141+
$iValue = ($y + 0.5);
142142

143143
for($x = 0; $x < $max; $x += 2){
144-
$points[$x] = ($x / 2) + 0.5;
145-
$points[$x + 1] = $iValue;
144+
$points[$x] = (($x / 2) + 0.5);
145+
$points[($x + 1)] = $iValue;
146146
}
147147

148148
$transform->transformPoints($points);
@@ -153,7 +153,7 @@ public function sampleGrid(BitMatrix $matrix, int $dimension, PerspectiveTransfo
153153
try{
154154
for($x = 0; $x < $max; $x += 2){
155155
// Black(-ish) pixel
156-
$bits->set($x / 2, $y, $matrix->check((int)$points[$x], (int)$points[$x + 1]), QRMatrix::M_DATA);
156+
$bits->set(($x / 2), $y, $matrix->check((int)$points[$x], (int)$points[($x + 1)]), QRMatrix::M_DATA);
157157
}
158158
}
159159
// @codeCoverageIgnoreStart

0 commit comments

Comments
 (0)