@@ -26,43 +26,43 @@ discard block |
||
26 | 26 | /** @var int */ |
27 | 27 | public const M_NULL = 0b000000000000; |
28 | 28 | /** @var int */ |
29 | - public const M_DARKMODULE = 0b000000000001 | self::IS_DARK; |
|
29 | + public const M_DARKMODULE = 0b000000000001|self::IS_DARK; |
|
30 | 30 | /** @var int */ |
31 | 31 | public const M_DATA = 0b000000000010; |
32 | 32 | /** @var int */ |
33 | - public const M_DATA_DARK = 0b000000000010 | self::IS_DARK; |
|
33 | + public const M_DATA_DARK = 0b000000000010|self::IS_DARK; |
|
34 | 34 | /** @var int */ |
35 | 35 | public const M_FINDER = 0b000000000100; |
36 | 36 | /** @var int */ |
37 | - public const M_FINDER_DARK = 0b000000000100 | self::IS_DARK; |
|
37 | + public const M_FINDER_DARK = 0b000000000100|self::IS_DARK; |
|
38 | 38 | /** @var int */ |
39 | 39 | public const M_SEPARATOR = 0b000000001000; |
40 | 40 | /** @var int */ |
41 | 41 | public const M_ALIGNMENT = 0b000000010000; |
42 | 42 | /** @var int */ |
43 | - public const M_ALIGNMENT_DARK = 0b000000010000 | self::IS_DARK; |
|
43 | + public const M_ALIGNMENT_DARK = 0b000000010000|self::IS_DARK; |
|
44 | 44 | /** @var int */ |
45 | 45 | public const M_TIMING = 0b000000100000; |
46 | 46 | /** @var int */ |
47 | - public const M_TIMING_DARK = 0b000000100000 | self::IS_DARK; |
|
47 | + public const M_TIMING_DARK = 0b000000100000|self::IS_DARK; |
|
48 | 48 | /** @var int */ |
49 | 49 | public const M_FORMAT = 0b000001000000; |
50 | 50 | /** @var int */ |
51 | - public const M_FORMAT_DARK = 0b000001000000 | self::IS_DARK; |
|
51 | + public const M_FORMAT_DARK = 0b000001000000|self::IS_DARK; |
|
52 | 52 | /** @var int */ |
53 | 53 | public const M_VERSION = 0b000010000000; |
54 | 54 | /** @var int */ |
55 | - public const M_VERSION_DARK = 0b000010000000 | self::IS_DARK; |
|
55 | + public const M_VERSION_DARK = 0b000010000000|self::IS_DARK; |
|
56 | 56 | /** @var int */ |
57 | 57 | public const M_QUIETZONE = 0b000100000000; |
58 | 58 | /** @var int */ |
59 | 59 | public const M_LOGO = 0b001000000000; |
60 | 60 | /** @var int */ |
61 | - public const M_FINDER_DOT = 0b010000000000 | self::IS_DARK; |
|
61 | + public const M_FINDER_DOT = 0b010000000000|self::IS_DARK; |
|
62 | 62 | /** @var int */ |
63 | 63 | public const M_TEST = 0b011111111111; |
64 | 64 | /** @var int */ |
65 | - public const M_TEST_DARK = 0b011111111111 | self::IS_DARK; |
|
65 | + public const M_TEST_DARK = 0b011111111111|self::IS_DARK; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Map of flag => coord |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected const neighbours = [ |
75 | 75 | 0b00000001 => [-1, -1], |
76 | - 0b00000010 => [ 0, -1], |
|
77 | - 0b00000100 => [ 1, -1], |
|
78 | - 0b00001000 => [ 1, 0], |
|
79 | - 0b00010000 => [ 1, 1], |
|
80 | - 0b00100000 => [ 0, 1], |
|
81 | - 0b01000000 => [-1, 1], |
|
82 | - 0b10000000 => [-1, 0], |
|
76 | + 0b00000010 => [0, -1], |
|
77 | + 0b00000100 => [1, -1], |
|
78 | + 0b00001000 => [1, 0], |
|
79 | + 0b00010000 => [1, 1], |
|
80 | + 0b00100000 => [0, 1], |
|
81 | + 0b01000000 => [-1, 1], |
|
82 | + 0b10000000 => [-1, 0], |
|
83 | 83 | ]; |
84 | 84 | |
85 | 85 | /** |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $matrix[$y] = []; |
160 | 160 | |
161 | 161 | foreach($row as $x => $val){ |
162 | - $matrix[$y][$x] = ($val & $this::IS_DARK) === $this::IS_DARK; |
|
162 | + $matrix[$y][$x] = ($val&$this::IS_DARK) === $this::IS_DARK; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -169,21 +169,21 @@ discard block |
||
169 | 169 | /** |
170 | 170 | * Returns the current version number |
171 | 171 | */ |
172 | - public function version():?Version{ |
|
172 | + public function version(): ?Version{ |
|
173 | 173 | return $this->version; |
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
177 | 177 | * Returns the current ECC level |
178 | 178 | */ |
179 | - public function eccLevel():?EccLevel{ |
|
179 | + public function eccLevel(): ?EccLevel{ |
|
180 | 180 | return $this->eccLevel; |
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
184 | 184 | * Returns the current mask pattern |
185 | 185 | */ |
186 | - public function maskPattern():?MaskPattern{ |
|
186 | + public function maskPattern(): ?MaskPattern{ |
|
187 | 187 | return $this->maskPattern; |
188 | 188 | } |
189 | 189 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | public function set(int $x, int $y, bool $value, int $M_TYPE):self{ |
218 | 218 | |
219 | 219 | if(isset($this->matrix[$y][$x])){ |
220 | - $this->matrix[$y][$x] = (($M_TYPE & ~$this::IS_DARK) | (($value) ? $this::IS_DARK : 0)); |
|
220 | + $this->matrix[$y][$x] = (($M_TYPE & ~$this::IS_DARK)|(($value) ? $this::IS_DARK : 0)); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $this; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | return false; |
247 | 247 | } |
248 | 248 | |
249 | - return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE; |
|
249 | + return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE; |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | // check if the field is the same type |
291 | 291 | if( |
292 | 292 | $M_TYPE_VALUE !== null |
293 | - && ($this->get(($x + $ix), ($y + $iy)) | $this::IS_DARK) !== ($M_TYPE_VALUE | $this::IS_DARK) |
|
293 | + && ($this->get(($x + $ix), ($y + $iy))|$this::IS_DARK) !== ($M_TYPE_VALUE|$this::IS_DARK) |
|
294 | 294 | ){ |
295 | 295 | continue; |
296 | 296 | } |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | |
371 | 371 | for($c = 0; $c < 3; $c++){ |
372 | 372 | for($i = 0; $i < 8; $i++){ |
373 | - $this->set($h[$c][0] , ($h[$c][1] + $i), false, $this::M_SEPARATOR); |
|
374 | - $this->set(($v[$c][0] - $i), $v[$c][1] , false, $this::M_SEPARATOR); |
|
373 | + $this->set($h[$c][0], ($h[$c][1] + $i), false, $this::M_SEPARATOR); |
|
374 | + $this->set(($v[$c][0] - $i), $v[$c][1], false, $this::M_SEPARATOR); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | for($y = 0; $y < $this->moduleCount; $y++){ |
596 | 596 | for($x = 0; $x < $this->moduleCount; $x++){ |
597 | 597 | // out of bounds, skip |
598 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
598 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
599 | 599 | continue; |
600 | 600 | } |
601 | 601 | // a match |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | |
664 | 664 | foreach($this->matrix as $y => $row){ |
665 | 665 | foreach($row as $x => $val){ |
666 | - if($mask($x, $y) && ($val & $this::M_DATA) === $this::M_DATA){ |
|
666 | + if($mask($x, $y) && ($val&$this::M_DATA) === $this::M_DATA){ |
|
667 | 667 | $this->flip($x, $y); |
668 | 668 | } |
669 | 669 | } |