Example #1
0
 public function __construct(QRinput $input)
 {
     $spec = array(0, 0, 0, 0, 0);
     $this->datacode = $input->getByteStream();
     if (is_null($this->datacode)) {
         throw new Exception('null imput string');
     }
     QRspec::getEccSpec($input->getVersion(), $input->getErrorCorrectionLevel(), $spec);
     $this->version = $input->getVersion();
     $this->b1 = QRspec::rsBlockNum1($spec);
     $this->dataLength = QRspec::rsDataLength($spec);
     $this->eccLength = QRspec::rsEccLength($spec);
     $this->ecccode = array_fill(0, $this->eccLength, 0);
     $this->blocks = QRspec::rsBlockNum($spec);
     $ret = $this->init($spec);
     if ($ret < 0) {
         throw new Exception('block alloc error');
         return null;
     }
     $this->count = 0;
 }