Completed
Push — master ( 06db8f...7dd0ed )
by Francimar
04:19
created

Generic::setMode()   B

Complexity

Conditions 6
Paths 8

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 11
cts 11
cp 1
rs 8.9617
c 0
b 0
f 0
cc 6
nc 8
nop 2
crap 6
1
<?php
2
3
namespace Thermal\Profile;
4
5
use Thermal\Printer;
6
7
class Generic extends EscPOS
8
{
9 1
    protected function setMode($mode, $enable)
10
    {
11 1
        if ($enable) {
12
            // enable styles
13 1
            if (Printer::STYLE_DOUBLE_WIDTH & $mode) {
14 1
                $this->getConnection()->write("\x0E");
15
            }
16 1
            if (Printer::STYLE_DOUBLE_HEIGHT & $mode) {
17 1
                $this->getConnection()->write("\ed1");
18
            }
19
        } else {
20
            // disable styles
21 1
            if (Printer::STYLE_DOUBLE_HEIGHT & $mode) {
22 1
                $this->getConnection()->write("\ed0");
23
            }
24 1
            if (Printer::STYLE_DOUBLE_WIDTH & $mode) {
25 1
                $this->getConnection()->write("\x14");
26
            }
27
        }
28 1
        return $this;
29
    }
30
}
31