diff --git a/src/Data/QRDataAbstract.php b/src/Data/QRDataAbstract.php index 62b0e78ef..4a539a3fc 100644 --- a/src/Data/QRDataAbstract.php +++ b/src/Data/QRDataAbstract.php @@ -101,13 +101,7 @@ abstract class QRDataAbstract implements QRDataInterface{ */ public function initMatrix(int $maskPattern, bool $test = null):QRMatrix{ return (new QRMatrix($this->version, $this->options->eccLevel)) - ->setFinderPattern() - ->setSeparators() - ->setAlignmentPattern() - ->setTimingPattern() - ->setVersionNumber($test) - ->setFormatInfo($maskPattern, $test) - ->setDarkModule() + ->init($maskPattern, $test) ->mapData($this->matrixdata, $maskPattern) ; } diff --git a/src/Data/QRMatrix.php b/src/Data/QRMatrix.php index b2934b714..76cbf8f0b 100755 --- a/src/Data/QRMatrix.php +++ b/src/Data/QRMatrix.php @@ -200,6 +200,21 @@ class QRMatrix{ $this->matrix = array_fill(0, $this->moduleCount, array_fill(0, $this->moduleCount, $this::M_NULL)); } + /** + * shortcut to initialize the matrix + */ + public function init(int $maskPattern, bool $test = null):QRMatrix{ + return $this + ->setFinderPattern() + ->setSeparators() + ->setAlignmentPattern() + ->setTimingPattern() + ->setVersionNumber($test) + ->setFormatInfo($maskPattern, $test) + ->setDarkModule() + ; + } + /** * */