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

Method newFromBytes

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

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

($size, $data)

Source from the content-addressed store, hash-verified

1812
1813 //----------------------------------------------------------------------
1814 public static function newFromBytes($size, $data)
1815 {
1816 $bstream = new QRbitstream();
1817 $bstream->allocate($size * 8);
1818 $p=0;
1819
1820 for($i=0; $i<$size; $i++) {
1821 $mask = 0x80;
1822 for($j=0; $j<8; $j++) {
1823 if($data[$i] & $mask) {
1824 $bstream->data[$p] = 1;
1825 } else {
1826 $bstream->data[$p] = 0;
1827 }
1828 $p++;
1829 $mask = $mask >> 1;
1830 }
1831 }
1832
1833 return $bstream;
1834 }
1835
1836 //----------------------------------------------------------------------
1837 public function append(QRbitstream $arg)

Callers 1

appendBytesMethod · 0.45

Calls 1

allocateMethod · 0.45

Tested by

no test coverage detected