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

Method getEccSpec

text-to-qr/lib/phpqrcode/phpqrcode.php:538–562  ·  view source on GitHub ↗
($version, $level, array &$spec)

Source from the content-addressed store, hash-verified

536 // CACHEABLE!!!
537
538 public static function getEccSpec($version, $level, array &$spec)
539 {
540 if (count($spec) < 5) {
541 $spec = array(0,0,0,0,0);
542 }
543
544 $b1 = self::$eccTable[$version][$level][0];
545 $b2 = self::$eccTable[$version][$level][1];
546 $data = self::getDataLength($version, $level);
547 $ecc = self::getECCLength($version, $level);
548
549 if($b2 == 0) {
550 $spec[0] = $b1;
551 $spec[1] = (int)($data / $b1);
552 $spec[2] = (int)($ecc / $b1);
553 $spec[3] = 0;
554 $spec[4] = 0;
555 } else {
556 $spec[0] = $b1;
557 $spec[1] = (int)($data / ($b1 + $b2));
558 $spec[2] = (int)($ecc / ($b1 + $b2));
559 $spec[3] = $b2;
560 $spec[4] = $spec[1] + 1;
561 }
562 }
563
564 // Alignment pattern ---------------------------------------------------
565

Callers 1

__constructMethod · 0.45

Calls 3

getDataLengthMethod · 0.95
getECCLengthMethod · 0.95
countFunction · 0.85

Tested by

no test coverage detected