File tree Expand file tree Collapse file tree 3 files changed +15
-11
lines changed Expand file tree Collapse file tree 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{
124124
125125 foreach (self ::PATTERNS as $ pattern ){
126126 $ mp = new self ($ pattern );
127- $ matrix = (clone $ QRMatrix )->setFormatInfo ($ mp )->mask ($ mp )->getMatrix ( true );
127+ $ matrix = (clone $ QRMatrix )->setFormatInfo ($ mp )->mask ($ mp )->getBooleanMatrix ( );
128128 $ penalty = 0 ;
129129
130130 for ($ level = 1 ; $ level <= 4 ; $ level ++){
Original file line number Diff line number Diff line change @@ -174,22 +174,26 @@ public function initFunctionalPatterns():static{
174174 }
175175
176176 /**
177- * Returns the data matrix, returns a pure boolean representation if $boolean is set to true
177+ * Returns the data matrix
178178 *
179179 * @return int[][]
180180 */
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+ }
186184
185+ /**
186+ * Returns a boolean representation of the data matrix
187+ *
188+ * @return bool[][]
189+ */
190+ public function getBooleanMatrix ():array {
187191 $ matrix = $ this ->matrix ;
188192
189193 foreach ($ matrix as &$ row ){
190194 $ row = array_map ($ this ->isDark (...), $ row );
191195 }
192-
196+ /** @var bool[][] $matrix (phpstan hates this otherwise) */
193197 return $ matrix ;
194198 }
195199
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ protected function setUp():void{
4242 * Tests if size() returns the actual matrix size/count
4343 */
4444 public function testGetSize ():void {
45- $ this ::assertCount ($ this ->matrix ->getSize (), $ this ->matrix ->getMatrix ( true ));
45+ $ this ::assertCount ($ this ->matrix ->getSize (), $ this ->matrix ->getBooleanMatrix ( ));
4646 }
4747
4848 /**
@@ -255,8 +255,8 @@ public function testSetQuietZone(QRMatrix $matrix):void{
255255
256256 $ s = ($ size + 2 * $ quietZoneSize );
257257
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 )]);
260260
261261 $ size = $ matrix ->getSize ();
262262
You can’t perform that action at this time.
0 commit comments