Beispiel #1
1
 function getMinimumQRCode($data, $errorCorrectLevel)
 {
     $mode = QRUtil::getMode($data);
     $qr = new QRCode();
     $qr->setErrorCorrectLevel($errorCorrectLevel);
     $qr->addData($data, $mode);
     $qrData = $qr->getData(0);
     $length = $qrData->getLength();
     for ($typeNumber = 1; $typeNumber <= 10; $typeNumber++) {
         if ($length <= QRUtil::getMaxLength($typeNumber, $mode, $errorCorrectLevel)) {
             $qr->setTypeNumber($typeNumber);
             break;
         }
     }
     $qr->make();
     return $qr;
 }