mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-24 13:37:54 +00:00
:octocat: fix no.1 for #45
This commit is contained in:
@@ -28,6 +28,8 @@ class MyCustomOutput extends QROutputAbstract{
|
||||
for($col = 0; $col < $this->moduleCount; $col++){
|
||||
$output .= (int)$this->matrix->check($col, $row);
|
||||
}
|
||||
|
||||
$output .= \PHP_EOL;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
@@ -617,6 +617,9 @@ final class QRMatrix{
|
||||
/**
|
||||
* ISO/IEC 18004:2000 Section 8.8.1
|
||||
*
|
||||
* Note that some versions of the QR code standard have had errors in the section about mask patterns.
|
||||
* The information below has been corrected. (https://www.thonky.com/qr-code-tutorial/mask-patterns)
|
||||
*
|
||||
* @see \chillerlan\QRCode\QRMatrix::mapData()
|
||||
*
|
||||
* @internal
|
||||
@@ -631,10 +634,10 @@ final class QRMatrix{
|
||||
|
||||
return [
|
||||
0b000 => fn($x, $y):int => ($x + $y) % 2,
|
||||
0b001 => fn($x, $y):int => $x % 2,
|
||||
0b010 => fn($x, $y):int => $y % 3,
|
||||
0b001 => fn($x, $y):int => $y % 2,
|
||||
0b010 => fn($x, $y):int => $x % 3,
|
||||
0b011 => fn($x, $y):int => ($x + $y) % 3,
|
||||
0b100 => fn($x, $y):int => ((int)($x / 2) + (int)($y / 3)) % 2,
|
||||
0b100 => fn($x, $y):int => ((int)($y / 2) + (int)($x / 3)) % 2,
|
||||
0b101 => fn($x, $y):int => (($x * $y) % 2) + (($x * $y) % 3),
|
||||
0b110 => fn($x, $y):int => ((($x * $y) % 2) + (($x * $y) % 3)) % 2,
|
||||
0b111 => fn($x, $y):int => ((($x * $y) % 3) + (($x + $y) % 2)) % 2,
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
namespace chillerlan\QRCodeTest\Output;
|
||||
|
||||
use chillerlan\QRCodeExamples\MyCustomOutput;
|
||||
use chillerlan\QRCode\{QRCode, QROptions};
|
||||
use chillerlan\QRCode\Data\{Byte, QRMatrix};
|
||||
use chillerlan\QRCode\Output\{QRCodeOutputException, QROutputInterface};
|
||||
@@ -131,19 +130,4 @@ abstract class QROutputTestAbstract extends TestCase{
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* covers the custom output functionality via an example
|
||||
*/
|
||||
public function testCustomOutput():void{
|
||||
$this->options->version = 5;
|
||||
$this->options->eccLevel = QRCode::ECC_L;
|
||||
$this->options->outputType = QRCode::OUTPUT_CUSTOM;
|
||||
$this->options->outputInterface = MyCustomOutput::class;
|
||||
|
||||
$this::assertSame(
|
||||
trim(file_get_contents(__DIR__.'/samples/custom')),
|
||||
(new QRCode($this->options))->render('test')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
namespace chillerlan\QRCodeTest\Output;
|
||||
|
||||
use chillerlan\QRCodeExamples\MyCustomOutput;
|
||||
use chillerlan\QRCode\{QRCode, QROptions};
|
||||
use chillerlan\QRCode\Output\{QROutputInterface, QRString};
|
||||
|
||||
@@ -57,4 +58,19 @@ class QRStringTest extends QROutputTestAbstract{
|
||||
$this::assertStringContainsString('B', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* covers the custom output functionality via an example
|
||||
*/
|
||||
public function testCustomOutput():void{
|
||||
$this->options->version = 5;
|
||||
$this->options->eccLevel = QRCode::ECC_L;
|
||||
$this->options->outputType = QRCode::OUTPUT_CUSTOM;
|
||||
$this->options->outputInterface = MyCustomOutput::class;
|
||||
|
||||
$this::assertSame(
|
||||
file_get_contents(__DIR__.'/samples/custom'),
|
||||
(new QRCode($this->options))->render('test')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +1,45 @@
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111110101011110100001011110011111110000000010000010011111001010011111001010000010000000010111010111000001101011000001010111010000000010111010111010110000011010110010111010000000010111010100110101100000110101010111010000000010000010001101011000001101011010000010000000011111110101010101010101010101011111110000000000000000001010011111001010011000000000000000011110010101111010000101111010100111010000000001110001001011110100001011110110010010000000001100010011111001010011111001011110010000000011010000101000001101011000001011001010000000001101011010010110000011010110100000100000000000001001001110101100000110101101011100000000011100010100101011000001101011001100000000000000001000101100101001111100101111101010000000000111011111010111101000010111101100000000000001111000010000101111010000101101001110000000000100011110001111100101001111101000110000000010001001001101100000110101100110100010000000011100111001001101011000001101111011000000000010110101000000011010110000011011101100000000001111011110000110101100000110100001000000000010111100001111110010100111110100110100000000011001011111100001011110100001011010110000000000100101001101000010111101000000100110000000001011011100010100111110010100110011100000000010010101010011010110000011010000010010000000000111011101100000110101100001111110000000000000000000111011000001101011001000110110000000011111110000110000011010110011010111110000000010000010010010011111001010011000111100000000010111010010111010000101111011111101100000000010111010101011110100001011111100010010000000010111010111111001010011111011101010100000000010000010111000001101011000011001101000000000011111110111010110000011010110111100110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000
|
||||
000011111110111010000101111010000011111110000
|
||||
000010000010111000001101011000001010000010000
|
||||
000010111010101101011000001101011010111010000
|
||||
000010111010110100111110010100111010111010000
|
||||
000010111010000001101011000001101010111010000
|
||||
000010000010100111110010100111110010000010000
|
||||
000011111110101010101010101010101011111110000
|
||||
000000000000010010100111110010100000000000000
|
||||
000011001110000101111010000101111001011110000
|
||||
000000000000111010000101111010000111100010000
|
||||
000001011010100111110010100111110011001010000
|
||||
000010000101111101011000001101011110011110000
|
||||
000000011010100011000001101011000101110100000
|
||||
000011001100001001101011000001101010011010000
|
||||
000010110111110000001101011000001100110100000
|
||||
000010000100100010100111110010100001100100000
|
||||
000011111110111101111010000101111010100110000
|
||||
000011010000111010000101111010000111100100000
|
||||
000010101111111111110010100111110011001000000
|
||||
000010110001110101011000001101011110011010000
|
||||
000001001111100011000001101011000101110010000
|
||||
000011000100110001101011000001101010011100000
|
||||
000001000011001000001101011000001100110000000
|
||||
000011101001011010100111110010100001100000000
|
||||
000010111010001101111010000101111010100110000
|
||||
000011100000001010000101111010000111100000000
|
||||
000000001110110111110010100111110011001000000
|
||||
000000011001011101011000001101011110011100000
|
||||
000011111110101011000001101011001111110110000
|
||||
000000000000110001101011000001101000111100000
|
||||
000011111110001000001101011000011010110000000
|
||||
000010000010101010100111110010101000100100000
|
||||
000010111010111101111010000101111111100110000
|
||||
000010111010011010000101111010001101100010000
|
||||
000010111010000111110010100111100101101100000
|
||||
000010000010101101011000001101001100111100000
|
||||
000011111110101011000001101011000110010110000
|
||||
000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000000000000
|
||||
|
||||
Reference in New Issue
Block a user