MCPcopy Create free account
hub / github.com/codemistic/Web-Development / identifyMode

Method identifyMode

text-to-qr/lib/phpqrcode/phpqrcode.php:2003–2027  ·  view source on GitHub ↗

----------------------------------------------------------------------

($pos)

Source from the content-addressed store, hash-verified

2001
2002 //----------------------------------------------------------------------
2003 public function identifyMode($pos)
2004 {
2005 if ($pos >= strlen($this->dataStr))
2006 return QR_MODE_NUL;
2007
2008 $c = $this->dataStr[$pos];
2009
2010 if(self::isdigitat($this->dataStr, $pos)) {
2011 return QR_MODE_NUM;
2012 } else if(self::isalnumat($this->dataStr, $pos)) {
2013 return QR_MODE_AN;
2014 } else if($this->modeHint == QR_MODE_KANJI) {
2015
2016 if ($pos+1 < strlen($this->dataStr))
2017 {
2018 $d = $this->dataStr[$pos+1];
2019 $word = (ord($c) << 8) | ord($d);
2020 if(($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) {
2021 return QR_MODE_KANJI;
2022 }
2023 }
2024 }
2025
2026 return QR_MODE_8;
2027 }
2028
2029 //----------------------------------------------------------------------
2030 public function eatNum()

Callers 5

eatNumMethod · 0.95
eatKanjiMethod · 0.95
eat8Method · 0.95
splitStringMethod · 0.95
toUpperMethod · 0.95

Calls 2

isdigitatMethod · 0.95
isalnumatMethod · 0.95

Tested by

no test coverage detected