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