From edd8e71e924fbc18ea9fec4ebd431aedb09a27da Mon Sep 17 00:00:00 2001 From: smiley Date: Wed, 24 Feb 2016 00:36:03 +0100 Subject: [PATCH] blah --- src/QRCode.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/QRCode.php b/src/QRCode.php index 736800c8b..1f280f68b 100644 --- a/src/QRCode.php +++ b/src/QRCode.php @@ -162,23 +162,18 @@ class QRCode{ * @throws \chillerlan\QRCode\QRCodeException */ protected function getTypeNumber($mode){ + /** @noinspection PhpUndefinedFieldInspection */ + $length = $this->qrDataInterface->mode === QRConst::MODE_KANJI + ? floor($this->qrDataInterface->dataLength / 2) + : $this->qrDataInterface->dataLength; - if($this->qrDataInterface instanceof QRDataInterface){ - /** @noinspection PhpUndefinedFieldInspection */ - $length = $this->qrDataInterface->mode === QRConst::MODE_KANJI - ? floor($this->qrDataInterface->dataLength / 2) - : $this->qrDataInterface->dataLength; - - foreach(range(1, 10) as $type){ - if($length <= Util::getMaxLength($type, $mode, $this->errorCorrectLevel)){ - return $type; - } + foreach(range(1, 10) as $type){ + if($length <= Util::getMaxLength($type, $mode, $this->errorCorrectLevel)){ + return $type; } - - throw new QRCodeException('Unable to determine type number.'); // @codeCoverageIgnore } - throw new QRCodeException('$this->qrDataInterface does not implement QRDataInterface'); // @codeCoverageIgnore + throw new QRCodeException('Unable to determine type number.'); // @codeCoverageIgnore } /**