Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
14 | 1 | public function drawer($number, $on_time, $off_time) |
|
15 | { |
||
16 | $index = [ |
||
17 | 1 | Printer::DRAWER_1 => '0' |
|
18 | ]; |
||
19 | 1 | if (!isset($index[$number])) { |
|
20 | 1 | throw new \Exception( |
|
21 | 1 | sprintf('Drawer %d not available for printer "%s"', $this->getName(), intval($number)), |
|
22 | 1 | 404 |
|
23 | ); |
||
24 | } |
||
25 | 1 | $on_time = min((int)($on_time / 2), 65); |
|
26 | 1 | $off_time = min((int)($off_time / 2), 65); |
|
27 | 1 | $this->getConnection()->write("\e&" . $index[$number] . chr($on_time) . chr($off_time)); |
|
28 | 1 | return $this; |
|
29 | } |
||
30 | } |
||
31 |