This commit is contained in:
smiley
2023-03-12 02:39:35 +01:00
parent c00a8adf9b
commit dd459fc1c4
8 changed files with 26 additions and 25 deletions
+9 -9
View File
@@ -130,7 +130,7 @@ final class MaskPatternTester{
}
if(
$val === $m[$y][$x + 1]
$val === $row[$x + 1]
&& $val === $m[$y + 1][$x]
&& $val === $m[$y + 1][$x + 1]
){
@@ -154,12 +154,12 @@ final class MaskPatternTester{
if(
$x + 6 < $size
&& $val
&& !$m[$y][$x + 1]
&& $m[$y][$x + 2]
&& $m[$y][$x + 3]
&& $m[$y][$x + 4]
&& !$m[$y][$x + 5]
&& $m[$y][$x + 6]
&& !$row[$x + 1]
&& $row[$x + 2]
&& $row[$x + 3]
&& $row[$x + 4]
&& !$row[$x + 5]
&& $row[$x + 6]
){
$penalties++;
}
@@ -189,8 +189,8 @@ final class MaskPatternTester{
protected function testLevel4(array $m, int $size):float{
$count = 0;
foreach($m as $y => $row){
foreach($row as $x => $val){
foreach($m as $row){
foreach($row as $val){
if($val){
$count++;
}
+5 -5
View File
@@ -21,7 +21,7 @@ interface QRDataInterface{
/**
* @var int[]
*/
const CHAR_MAP_NUMBER = [
public const CHAR_MAP_NUMBER = [
'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9,
];
@@ -30,7 +30,7 @@ interface QRDataInterface{
*
* @var int[]
*/
const CHAR_MAP_ALPHANUM = [
public const CHAR_MAP_ALPHANUM = [
'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, '7' => 7,
'8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15,
'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22, 'N' => 23,
@@ -46,7 +46,7 @@ interface QRDataInterface{
*
* @var int [][][]
*/
const MAX_LENGTH =[
public const MAX_LENGTH =[
// v => [NUMERIC => [L, M, Q, H ], ALPHANUM => [L, M, Q, H], BINARY => [L, M, Q, H ], KANJI => [L, M, Q, H ]] // modules
1 => [[ 41, 34, 27, 17], [ 25, 20, 16, 10], [ 17, 14, 11, 7], [ 10, 8, 7, 4]], // 21
2 => [[ 77, 63, 48, 34], [ 47, 38, 29, 20], [ 32, 26, 20, 14], [ 20, 16, 12, 8]], // 25
@@ -95,7 +95,7 @@ interface QRDataInterface{
*
* @var int [][]
*/
const MAX_BITS = [
public const MAX_BITS = [
// version => [L, M, Q, H ]
1 => [ 152, 128, 104, 72],
2 => [ 272, 224, 176, 128],
@@ -144,7 +144,7 @@ interface QRDataInterface{
*
* @var int [][][]
*/
const RSBLOCKS = [
public const RSBLOCKS = [
1 => [[ 1, 0, 26, 19], [ 1, 0, 26, 16], [ 1, 0, 26, 13], [ 1, 0, 26, 9]],
2 => [[ 1, 0, 44, 34], [ 1, 0, 44, 28], [ 1, 0, 44, 22], [ 1, 0, 44, 16]],
3 => [[ 1, 0, 70, 55], [ 1, 0, 70, 44], [ 2, 0, 35, 17], [ 2, 0, 35, 13]],
+2 -2
View File
@@ -624,8 +624,8 @@ final class QRMatrix{
$startY = ($startY !== null ? $startY : ($length - $height) / 2) + $qz;
// clear the space
foreach($this->matrix as $y => $row){
foreach($row as $x => $val){
for($y = 0; $y < $this->moduleCount; $y++){
for($x = 0; $x < $this->moduleCount; $x++){
// out of bounds, skip
if($x < $start || $y < $start ||$x >= $end || $y >= $end){
continue;
+2 -2
View File
@@ -157,7 +157,7 @@ final class Polynomial{
throw new QRCodeException(sprintf('log(%s)', $n));
}
return Polynomial::table[$n][1];
return self::table[$n][1];
}
/**
@@ -172,7 +172,7 @@ final class Polynomial{
$n -= 255;
}
return Polynomial::table[$n][0];
return self::table[$n][0];
}
}
+2 -1
View File
@@ -12,7 +12,8 @@
namespace chillerlan\QRCode\Output;
use chillerlan\QRCode\{Data\QRMatrix, QRCode};
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\Data\QRMatrix;
use chillerlan\Settings\SettingsContainerInterface;
use function call_user_func_array, dirname, file_put_contents, get_called_class, in_array, is_writable, sprintf;
+1 -1
View File
@@ -19,7 +19,7 @@ use chillerlan\QRCode\Data\QRMatrix;
*/
interface QROutputInterface{
const DEFAULT_MODULE_VALUES = [
public const DEFAULT_MODULE_VALUES = [
// light
QRMatrix::M_NULL => false, // 0
QRMatrix::M_DATA => false, // 4
+4 -4
View File
@@ -117,23 +117,23 @@ class QRCode{
* @var string[][]
*/
public const OUTPUT_MODES = [
QRMarkup::class => [
QRMarkup::class => [
self::OUTPUT_MARKUP_SVG,
self::OUTPUT_MARKUP_HTML,
],
QRImage::class => [
QRImage::class => [
self::OUTPUT_IMAGE_PNG,
self::OUTPUT_IMAGE_GIF,
self::OUTPUT_IMAGE_JPG,
],
QRString::class => [
QRString::class => [
self::OUTPUT_STRING_JSON,
self::OUTPUT_STRING_TEXT,
],
QRImagick::class => [
self::OUTPUT_IMAGICK,
],
QRFpdf::class => [
QRFpdf::class => [
self::OUTPUT_FPDF
]
];
+1 -1
View File
@@ -80,7 +80,7 @@ class QROptionsTest extends TestCase{
*/
public function MaskPatternProvider():array{
return [
'exceed max' => [42, 7,],
'exceed max' => [42, 7],
'exceed min' => [-42, 0],
'default (-1)' => [QRCode::MASK_PATTERN_AUTO, -1],
];