@@ -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 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * false => $M_TYPE |
| 172 | 172 | */ |
| 173 | 173 | public function set(int $x, int $y, bool $value, int $M_TYPE):self{ |
| 174 | - $this->matrix[$y][$x] = $M_TYPE | ($value ? $this::IS_DARK : 0); |
|
| 174 | + $this->matrix[$y][$x] = $M_TYPE|($value ? $this::IS_DARK : 0); |
|
| 175 | 175 | |
| 176 | 176 | return $this; |
| 177 | 177 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * true => $value & $M_TYPE === $M_TYPE |
| 192 | 192 | */ |
| 193 | 193 | public function checkType(int $x, int $y, int $M_TYPE):bool{ |
| 194 | - return ($this->matrix[$y][$x] & $M_TYPE) === $M_TYPE; |
|
| 194 | + return ($this->matrix[$y][$x]&$M_TYPE) === $M_TYPE; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | for($c = 0; $c < 3; $c++){ |
| 287 | 287 | for($i = 0; $i < 8; $i++){ |
| 288 | - $this->set($h[$c][0] , $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
| 289 | - $this->set($v[$c][0] - $i, $v[$c][1] , false, $this::M_SEPARATOR); |
|
| 288 | + $this->set($h[$c][0], $h[$c][1] + $i, false, $this::M_SEPARATOR); |
|
| 289 | + $this->set($v[$c][0] - $i, $v[$c][1], false, $this::M_SEPARATOR); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | foreach($this->matrix as $y => $row){ |
| 511 | 511 | foreach($row as $x => $val){ |
| 512 | 512 | // out of bounds, skip |
| 513 | - if($x < $start || $y < $start ||$x >= $end || $y >= $end){ |
|
| 513 | + if($x < $start || $y < $start || $x >= $end || $y >= $end){ |
|
| 514 | 514 | continue; |
| 515 | 515 | } |
| 516 | 516 | // a match |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | foreach($this->matrix as $y => $row){ |
| 580 | 580 | foreach($row as $x => $val){ |
| 581 | - if($mask($x, $y) && ($val & $this::M_DATA) === $this::M_DATA){ |
|
| 581 | + if($mask($x, $y) && ($val&$this::M_DATA) === $this::M_DATA){ |
|
| 582 | 582 | $this->flip($x, $y); |
| 583 | 583 | } |
| 584 | 584 | } |