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

Class QRencode

text-to-qr/lib/phpqrcode/qrencode.php:396–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394 //##########################################################################
395
396 class QRencode {
397
398 public $casesensitive = true;
399 public $eightbit = false;
400
401 public $version = 0;
402 public $size = 3;
403 public $margin = 4;
404
405 public $structured = 0; // not supported yet
406
407 public $level = QR_ECLEVEL_L;
408 public $hint = QR_MODE_8;
409
410 //----------------------------------------------------------------------
411 public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
412 {
413 $enc = new QRencode();
414 $enc->size = $size;
415 $enc->margin = $margin;
416
417 switch ($level.'') {
418 case '0':
419 case '1':
420 case '2':
421 case '3':
422 $enc->level = $level;
423 break;
424 case 'l':
425 case 'L':
426 $enc->level = QR_ECLEVEL_L;
427 break;
428 case 'm':
429 case 'M':
430 $enc->level = QR_ECLEVEL_M;
431 break;
432 case 'q':
433 case 'Q':
434 $enc->level = QR_ECLEVEL_Q;
435 break;
436 case 'h':
437 case 'H':
438 $enc->level = QR_ECLEVEL_H;
439 break;
440 }
441
442 return $enc;
443 }
444
445 //----------------------------------------------------------------------
446 public function encodeRAW($intext, $outfile = false)
447 {
448 $code = new QRcode();
449
450 if($this->eightbit) {
451 $code->encodeString8bit($intext, $this->version, $this->level);
452 } else {
453 $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected