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

Method identifyMode

text-to-qr/lib/phpqrcode/qrsplit.php:66–90  ·  view source on GitHub ↗

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

($pos)

Source from the content-addressed store, hash-verified

64
65 //----------------------------------------------------------------------
66 public function identifyMode($pos)
67 {
68 if ($pos >= strlen($this->dataStr))
69 return QR_MODE_NUL;
70
71 $c = $this->dataStr[$pos];
72
73 if(self::isdigitat($this->dataStr, $pos)) {
74 return QR_MODE_NUM;
75 } else if(self::isalnumat($this->dataStr, $pos)) {
76 return QR_MODE_AN;
77 } else if($this->modeHint == QR_MODE_KANJI) {
78
79 if ($pos+1 < strlen($this->dataStr))
80 {
81 $d = $this->dataStr[$pos+1];
82 $word = (ord($c) << 8) | ord($d);
83 if(($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) {
84 return QR_MODE_KANJI;
85 }
86 }
87 }
88
89 return QR_MODE_8;
90 }
91
92 //----------------------------------------------------------------------
93 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