Passed
Push — master ( 514bca...891b04 )
by smiley
02:57
created

Byte   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A write() 0 6 2
1
<?php
2
/**
3
 * Class Byte
4
 *
5
 * @filesource   Byte.php
6
 * @created      25.11.2015
7
 * @package      chillerlan\QRCode\Data
8
 * @author       Smiley <[email protected]>
9
 * @copyright    2015 Smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\QRCode\Data;
14
15
use chillerlan\QRCode\QRCode;
16
17
use function ord;
18
19
/**
20
 * Byte mode, ISO-8859-1 or UTF-8
21
 */
22
class Byte extends QRDataAbstract{
23
24
	protected int $datamode = QRCode::DATA_BYTE;
25
26
	protected array $lengthBits = [8, 16, 16];
27
28
	/**
29
	 * @inheritdoc
30
	 */
31
	protected function write(string $data):void{
32
		$i = 0;
33
34
		while($i < $this->strlen){
35
			$this->bitBuffer->put(ord($data[$i]), 8);
36
			$i++;
37
		}
38
39
	}
40
41
}
42