/** * @param int $dl data length * @param array $data the data of the code block * @param int $el length of the ecc * @param array $ecc specs * @param RsItem $rs * * @see Specifications::rsEccCodes2 */ public function __construct($dl, $data, $el, $ecc, RsItem $rs) { $rs->encodeRsChar($data, $ecc); $this->dataLength = $dl; $this->data = $data; $this->eccLength = $el; $this->ecc = $ecc; }
/** * @param $symSize * @param $gfPoly * @param $fcr * @param $prim * @param $nRoots * @param $pad * * @return RsItem|null */ public static function initRs($symSize, $gfPoly, $fcr, $prim, $nRoots, $pad) { foreach (static::$items as $rs) { if ($rs->pad != $pad) { continue; } if ($rs->nRoots != $nRoots) { continue; } if ($rs->mm != $symSize) { continue; } if ($rs->gfPoly != $gfPoly) { continue; } if ($rs->fcr != $fcr) { continue; } if ($rs->prim != $prim) { continue; } return $rs; } $rs = RsItem::initRsChar($symSize, $gfPoly, $fcr, $prim, $nRoots, $pad); array_unshift(static::$items, $rs); return $rs; }