@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | // This class uses 5x5 blocks to compute local luminance, where each block is 8x8 pixels. |
| 37 | 37 | // So this is the smallest dimension in each axis we can accept. |
| 38 | 38 | private const BLOCK_SIZE_POWER = 3; |
| 39 | - private const BLOCK_SIZE = 8; // ...0100...00 |
|
| 40 | - private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
| 39 | + private const BLOCK_SIZE = 8; // ...0100...00 |
|
| 40 | + private const BLOCK_SIZE_MASK = 7; // ...0011...11 |
|
| 41 | 41 | private const MINIMUM_DIMENSION = 40; |
| 42 | 42 | private const MIN_DYNAMIC_RANGE = 24; |
| 43 | 43 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | for($xx = 0; $xx < self::BLOCK_SIZE; $xx++){ |
| 236 | 236 | $pixel = (int)($this->luminances[(int)($offset + $xx)]) & 0xff; |
| 237 | - $sum += $pixel; |
|
| 237 | + $sum += $pixel; |
|
| 238 | 238 | // still looking for good contrast |
| 239 | 239 | if($pixel < $min){ |
| 240 | 240 | $min = $pixel; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $matrix[$y] = []; |
| 121 | 121 | |
| 122 | 122 | foreach($row as $x => $val){ |
| 123 | - $matrix[$y][$x] = ($val & $this::IS_DARK) === $this::IS_DARK; |
|
| 123 | + $matrix[$y][$x] = ($val&$this::IS_DARK) === $this::IS_DARK; |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -130,21 +130,21 @@ discard block |
||
| 130 | 130 | /** |
| 131 | 131 | * Returns the current version number |
| 132 | 132 | */ |
| 133 | - public function version():?Version{ |
|
| 133 | + public function version(): ?Version{ |
|
| 134 | 134 | return $this->version; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | 138 | * Returns the current ECC level |
| 139 | 139 | */ |
| 140 | - public function eccLevel():?EccLevel{ |
|
| 140 | + public function eccLevel(): ?EccLevel{ |
|
| 141 | 141 | return $this->eccLevel; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Returns the current mask pattern |
| 146 | 146 | */ |
| 147 | - public function maskPattern():?MaskPattern{ |
|
| 147 | + public function maskPattern(): ?MaskPattern{ |
|
| 148 | 148 | return $this->maskPattern; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | public function set(int $x, int $y, bool $value, int $M_TYPE):self{ |
| 179 | 179 | |
| 180 | 180 | if(isset($this->matrix[$y][$x])){ |
| 181 | - $this->matrix[$y][$x] = $M_TYPE | ($value ? $this::IS_DARK : 0); |
|
| 181 | + $this->matrix[$y][$x] = $M_TYPE|($value ? $this::IS_DARK : 0); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | return $this; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | return false; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE; |
|
| 210 | + return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | for($c = 0; $c < 3; $c++){ |
| 304 | 304 | for($i = 0; $i < 8; $i++){ |
| 305 | - $this->set($h[$c][0] , $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
| 306 | - $this->set($v[$c][0] - $i, $v[$c][1] , false, $this::M_SEPARATOR); |
|
| 305 | + $this->set($h[$c][0], $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
| 306 | + $this->set($v[$c][0] - $i, $v[$c][1], false, $this::M_SEPARATOR); |
|
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | foreach($this->matrix as $y => $row){ |
| 528 | 528 | foreach($row as $x => $val){ |
| 529 | 529 | // out of bounds, skip |
| 530 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
| 530 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
| 531 | 531 | continue; |
| 532 | 532 | } |
| 533 | 533 | // a match |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | |
| 596 | 596 | foreach($this->matrix as $y => $row){ |
| 597 | 597 | foreach($row as $x => $val){ |
| 598 | - if($mask($x, $y) && ($val & $this::M_DATA) === $this::M_DATA){ |
|
| 598 | + if($mask($x, $y) && ($val&$this::M_DATA) === $this::M_DATA){ |
|
| 599 | 599 | $this->flip($x, $y); |
| 600 | 600 | } |
| 601 | 601 | } |