@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function selectTextScrollMode(int $mode = AuresCustomerDisplay::TEXT_VERTICAL_SCROLL) |
78 | 78 | { |
79 | 79 | self::validateInteger($mode, 1, 3, __FUNCTION__); |
80 | - $this->connector->write("\x1F" . chr($mode)); |
|
80 | + $this->connector->write("\x1F".chr($mode)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function feed(int $lines = 1) |
143 | 143 | { |
144 | 144 | self::validateInteger($lines, 1, 255, __FUNCTION__); |
145 | - for ($i = 0; $i < $lines; $i ++) { |
|
145 | + for ($i = 0; $i < $lines; $i++) { |
|
146 | 146 | $this->connector->write("\r\n"); |
147 | 147 | } |
148 | 148 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /* Faster to average channels, blend alpha and negate the image here than via filters (tested!) */ |
44 | 44 | $cols = $im -> getImagePixelColor($x, $y); |
45 | 45 | $cols = $cols -> getcolor(); |
46 | - $greyness = (int)(($cols['r'] + $cols['g'] + $cols['b']) / 3) >> 7; // 1 for white, 0 for black |
|
46 | + $greyness = (int) (($cols['r'] + $cols['g'] + $cols['b']) / 3) >> 7; // 1 for white, 0 for black |
|
47 | 47 | $imgData[$y * $imgWidth + $x] = (1 - $greyness); // 1 for black, 0 for white |
48 | 48 | } |
49 | 49 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | public static function loadPdf($pdfFile, int $pageWidth = 550) |
215 | 215 | { |
216 | 216 | if (!EscposImage::isImagickLoaded()) { |
217 | - throw new Exception(__FUNCTION__ . " requires imagick extension."); |
|
217 | + throw new Exception(__FUNCTION__." requires imagick extension."); |
|
218 | 218 | } |
219 | 219 | /* |
220 | 220 | * Load first page at very low density (resolution), to figure out what |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function getHeightBytes() |
112 | 112 | { |
113 | - return (int)(($this -> imgHeight + 7) / 8); |
|
113 | + return (int) (($this -> imgHeight + 7) / 8); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getWidthBytes() |
128 | 128 | { |
129 | - return (int)(($this -> imgWidth + 7) / 8); |
|
129 | + return (int) (($this -> imgWidth + 7) / 8); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | return $data; |
283 | 283 | } |
284 | 284 | do { |
285 | - $byteVal |= (int)$this -> imgData[$y * $widthPixels + $x] << (7 - $bit); |
|
285 | + $byteVal |= (int) $this -> imgData[$y * $widthPixels + $x] << (7 - $bit); |
|
286 | 286 | $x++; |
287 | 287 | $bit++; |
288 | 288 | if ($x >= $widthPixels) { |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | } while (true); |
304 | 304 | if (strlen($data) != ($this -> getWidthBytes() * $this -> getHeight())) { |
305 | - throw new Exception("Bug in " . __FUNCTION__ . ", wrong number of bytes."); |
|
305 | + throw new Exception("Bug in ".__FUNCTION__.", wrong number of bytes."); |
|
306 | 306 | } |
307 | 307 | return $data; |
308 | 308 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | do { |
360 | 360 | $yReal = $y + $yStart; |
361 | 361 | if ($yReal < $heightPixels) { |
362 | - $byteVal |= (int)$this -> imgData[$yReal * $widthPixels + $x] << (7 - $bit); |
|
362 | + $byteVal |= (int) $this -> imgData[$yReal * $widthPixels + $x] << (7 - $bit); |
|
363 | 363 | } |
364 | 364 | $y++; |
365 | 365 | $bit++; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | } |
381 | 381 | } while (true); |
382 | 382 | if (strlen($data) != $widthPixels * $lineHeight) { |
383 | - throw new Exception("Bug in " . __FUNCTION__ . ", wrong number of bytes."); |
|
383 | + throw new Exception("Bug in ".__FUNCTION__.", wrong number of bytes."); |
|
384 | 384 | } |
385 | 385 | return $data; |
386 | 386 | } |
@@ -109,7 +109,7 @@ |
||
109 | 109 | // TODO We can sort into batches of contiguous characters here. |
110 | 110 | foreach ($chars as $char => $glyph) { |
111 | 111 | $verticalBytes = 3; |
112 | - $data = Printer::ESC . "&" . chr($verticalBytes) . chr($char) . chr($char) . chr($glyph -> width) . $glyph -> data; |
|
112 | + $data = Printer::ESC."&".chr($verticalBytes).chr($char).chr($char).chr($glyph -> width).$glyph -> data; |
|
113 | 113 | $this -> printer -> getPrintConnector() -> write($data); |
114 | 114 | } |
115 | 115 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | public static function colFormat16(array $in) |
11 | 11 | { |
12 | 12 | // Map 16 x 16 bit unifont (32 bytes) to 16 x 24 ESC/POS column format image (48 bytes). |
13 | - return UnifontGlyphFactory::colFormat8($in, 2, 1) . UnifontGlyphFactory::colFormat8($in, 2, 2); |
|
13 | + return UnifontGlyphFactory::colFormat8($in, 2, 1).UnifontGlyphFactory::colFormat8($in, 2, 2); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public static function colFormat8(array $in, $chars = 1, $idx = 1) |
@@ -43,7 +43,7 @@ |
||
43 | 43 | { |
44 | 44 | if (!$this -> started) { |
45 | 45 | $mode = Printer::MODE_FONT_B | Printer::MODE_DOUBLE_HEIGHT | Printer::MODE_DOUBLE_WIDTH; |
46 | - $this -> printer -> getPrintConnector() -> write(Printer::ESC . "!" . chr($mode)); |
|
46 | + $this -> printer -> getPrintConnector() -> write(Printer::ESC."!".chr($mode)); |
|
47 | 47 | $this -> printer -> selectUserDefinedCharacterSet(true); |
48 | 48 | } |
49 | 49 | // Normalize text - this replaces combining characters with composed glyphs, and also helps us eliminated bad UTF-8 early |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | { |
47 | 47 | $valid = $this->getLocalPrinters(); |
48 | 48 | if (count($valid) == 0) { |
49 | - throw new BadMethodCallException("You do not have any printers installed on " . |
|
49 | + throw new BadMethodCallException("You do not have any printers installed on ". |
|
50 | 50 | "this system via CUPS. Check 'lpr -a'."); |
51 | 51 | } |
52 | 52 | |
53 | 53 | if (array_search($dest, $valid, true) === false) { |
54 | - throw new BadMethodCallException("'$dest' is not a printer on this system. " . |
|
55 | - "Printers are: [" . implode(", ", $valid) . "]"); |
|
54 | + throw new BadMethodCallException("'$dest' is not a printer on this system. ". |
|
55 | + "Printers are: [".implode(", ", $valid)."]"); |
|
56 | 56 | } |
57 | - $this->buffer = array (); |
|
57 | + $this->buffer = array(); |
|
58 | 58 | $this->printerName = $dest; |
59 | 59 | } |
60 | 60 | |
@@ -105,18 +105,18 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function getCmdOutput($cmd) |
107 | 107 | { |
108 | - $descriptors = array ( |
|
109 | - 1 => array ( |
|
108 | + $descriptors = array( |
|
109 | + 1 => array( |
|
110 | 110 | "pipe", |
111 | 111 | "w" |
112 | 112 | ), |
113 | - 2 => array ( |
|
113 | + 2 => array( |
|
114 | 114 | "pipe", |
115 | 115 | "w" |
116 | 116 | ) |
117 | 117 | ); |
118 | 118 | $process = proc_open($cmd, $descriptors, $fd); |
119 | - if (! is_resource($process)) { |
|
119 | + if (!is_resource($process)) { |
|
120 | 120 | throw new Exception("Command '$cmd' failed to start."); |
121 | 121 | } |
122 | 122 | /* Read stdout */ |
@@ -53,7 +53,7 @@ |
||
53 | 53 | public function finalize() |
54 | 54 | { |
55 | 55 | ob_end_clean(); |
56 | - echo "intent:base64," . base64_encode($this->getData()) . "#Intent;scheme=rawbt;package=ru.a402d.rawbtprinter;end;"; |
|
56 | + echo "intent:base64,".base64_encode($this->getData())."#Intent;scheme=rawbt;package=ru.a402d.rawbtprinter;end;"; |
|
57 | 57 | $this->buffer = null; |
58 | 58 | } |
59 | 59 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | $this -> fp = @fsockopen($ip, $port, $errno, $errstr, $timeout); |
37 | 37 | if ($this -> fp === false) { |
38 | - throw new Exception("Cannot initialise NetworkPrintConnector: " . $errstr); |
|
38 | + throw new Exception("Cannot initialise NetworkPrintConnector: ".$errstr); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |