From a08d080d96d0f1756a96d8401f2b7a99735015b5 Mon Sep 17 00:00:00 2001 From: Bostjan Rihter Date: Sun, 11 Mar 2018 00:29:05 +0100 Subject: [PATCH] Tabs. --- src/QRCode.php | 5 +++-- tests/QRCodeTest.php | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/QRCode.php b/src/QRCode.php index d7ec8abb1..625d994bf 100755 --- a/src/QRCode.php +++ b/src/QRCode.php @@ -161,8 +161,9 @@ class QRCode{ * @throws \chillerlan\QRCode\Data\QRCodeDataException */ public function getMatrix(string $data):QRMatrix { - //NOTE: input sanitization should be done outside - //$data = trim($data); + //NOTE: input sanitization should be done outside + //$data = trim($data); + if(empty($data)){ throw new QRCodeDataException('QRCode::getMatrix() No data given.'); } diff --git a/tests/QRCodeTest.php b/tests/QRCodeTest.php index edeb9569a..046715240 100755 --- a/tests/QRCodeTest.php +++ b/tests/QRCodeTest.php @@ -94,12 +94,12 @@ class QRCodeTest extends QRTestAbstract{ $this->qrcode->getMatrix(''); } - public function testTrim() { - $m1 = $this->qrcode->getMatrix('hello'); - $m2 = $this->qrcode->getMatrix('hello '); // added space + public function testTrim() { + $m1 = $this->qrcode->getMatrix('hello'); + $m2 = $this->qrcode->getMatrix('hello '); // added space - $this->assertNotEquals($m1, $m2); - } + $this->assertNotEquals($m1, $m2); + } public function testImageTransparencyBGDefault(){ $this->qrcode = $this->reflection->newInstanceArgs([new QROptions(['imageTransparencyBG' => 'foo'])]);