File tree 3 files changed +15
-11
lines changed
3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ public static function getBestPattern(QRMatrix $QRMatrix):self{
124
124
125
125
foreach (self ::PATTERNS as $ pattern ){
126
126
$ mp = new self ($ pattern );
127
- $ matrix = (clone $ QRMatrix )->setFormatInfo ($ mp )->mask ($ mp )->getMatrix ( true );
127
+ $ matrix = (clone $ QRMatrix )->setFormatInfo ($ mp )->mask ($ mp )->getBooleanMatrix ( );
128
128
$ penalty = 0 ;
129
129
130
130
for ($ level = 1 ; $ level <= 4 ; $ level ++){
Original file line number Diff line number Diff line change @@ -174,22 +174,26 @@ public function initFunctionalPatterns():static{
174
174
}
175
175
176
176
/**
177
- * Returns the data matrix, returns a pure boolean representation if $boolean is set to true
177
+ * Returns the data matrix
178
178
*
179
179
* @return int[][]
180
180
*/
181
- public function getMatrix (bool |null $ boolean = null ):array {
182
-
183
- if ($ boolean !== true ){
184
- return $ this ->matrix ;
185
- }
181
+ public function getMatrix ():array {
182
+ return $ this ->matrix ;
183
+ }
186
184
185
+ /**
186
+ * Returns a boolean representation of the data matrix
187
+ *
188
+ * @return bool[][]
189
+ */
190
+ public function getBooleanMatrix ():array {
187
191
$ matrix = $ this ->matrix ;
188
192
189
193
foreach ($ matrix as &$ row ){
190
194
$ row = array_map ($ this ->isDark (...), $ row );
191
195
}
192
-
196
+ /** @var bool[][] $matrix (phpstan hates this otherwise) */
193
197
return $ matrix ;
194
198
}
195
199
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ protected function setUp():void{
42
42
* Tests if size() returns the actual matrix size/count
43
43
*/
44
44
public function testGetSize ():void {
45
- $ this ::assertCount ($ this ->matrix ->getSize (), $ this ->matrix ->getMatrix ( true ));
45
+ $ this ::assertCount ($ this ->matrix ->getSize (), $ this ->matrix ->getBooleanMatrix ( ));
46
46
}
47
47
48
48
/**
@@ -255,8 +255,8 @@ public function testSetQuietZone(QRMatrix $matrix):void{
255
255
256
256
$ s = ($ size + 2 * $ quietZoneSize );
257
257
258
- $ this ::assertCount ($ s , $ matrix ->getMatrix ( true ));
259
- $ this ::assertCount ($ s , $ matrix ->getMatrix ( true )[($ size - 1 )]);
258
+ $ this ::assertCount ($ s , $ matrix ->getBooleanMatrix ( ));
259
+ $ this ::assertCount ($ s , $ matrix ->getBooleanMatrix ( )[($ size - 1 )]);
260
260
261
261
$ size = $ matrix ->getSize ();
262
262
You can’t perform that action at this time.
0 commit comments