QRrs.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * PHP QR Code encoder
  4. *
  5. * Reed-Solomon error correction support
  6. *
  7. * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
  8. * (libfec is released under the GNU Lesser General Public License.)
  9. *
  10. * Based on libqrencode C library distributed under LGPL 2.1
  11. * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
  12. *
  13. * PHP QR Code is distributed under LGPL 3
  14. * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
  15. *
  16. * This library is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU Lesser General Public
  18. * License as published by the Free Software Foundation; either
  19. * version 3 of the License, or any later version.
  20. *
  21. * This library is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  24. * Lesser General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Lesser General Public
  27. * License along with this library; if not, write to the Free Software
  28. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  29. */
  30. namespace PHPQRCode;
  31. class QRrs {
  32. public static $items = array();
  33. //----------------------------------------------------------------------
  34. public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
  35. {
  36. foreach(self::$items as $rs) {
  37. if($rs->pad != $pad) continue;
  38. if($rs->nroots != $nroots) continue;
  39. if($rs->mm != $symsize) continue;
  40. if($rs->gfpoly != $gfpoly) continue;
  41. if($rs->fcr != $fcr) continue;
  42. if($rs->prim != $prim) continue;
  43. return $rs;
  44. }
  45. $rs = QRrsItem::init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad);
  46. array_unshift(self::$items, $rs);
  47. return $rs;
  48. }
  49. }