@@ -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 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | if (preg_match(self::REGEX_LOCAL, $dest) == 1) { |
| 118 | 118 | // Straight to LPT1, COM1 or other local port. Allowed only if we are actually on windows. |
| 119 | 119 | if ($this -> platform !== self::PLATFORM_WIN) { |
| 120 | - throw new BadMethodCallException("WindowsPrintConnector can only be " . |
|
| 120 | + throw new BadMethodCallException("WindowsPrintConnector can only be ". |
|
| 121 | 121 | "used to print to a local printer ('".$dest."') on a Windows computer."); |
| 122 | 122 | } |
| 123 | 123 | $this -> isLocal = true; |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $this -> hostname = $hostname; |
| 153 | 153 | $this -> printerName = $dest; |
| 154 | 154 | } else { |
| 155 | - throw new BadMethodCallException("Printer '" . $dest . "' is not a valid " . |
|
| 155 | + throw new BadMethodCallException("Printer '".$dest."' is not a valid ". |
|
| 156 | 156 | "printer name. Use local port (LPT1, COM1, etc) or smb://computer/printer notation."); |
| 157 | 157 | } |
| 158 | 158 | $this -> buffer = []; |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | protected function finalizeLinux($data) |
| 188 | 188 | { |
| 189 | 189 | /* Non-Windows samba printing */ |
| 190 | - $device = "//" . $this -> hostname . "/" . $this -> printerName; |
|
| 190 | + $device = "//".$this -> hostname."/".$this -> printerName; |
|
| 191 | 191 | if ($this -> userName !== null) { |
| 192 | - $user = ($this -> workgroup != null ? ($this -> workgroup . "\\") : "") . $this -> userName; |
|
| 192 | + $user = ($this -> workgroup != null ? ($this -> workgroup."\\") : "").$this -> userName; |
|
| 193 | 193 | if ($this -> userPassword == null) { |
| 194 | 194 | // No password |
| 195 | 195 | $command = sprintf( |
@@ -227,8 +227,8 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | $retval = $this -> runCommand($command, $outputStr, $errorStr, $data); |
| 229 | 229 | if ($retval != 0) { |
| 230 | - throw new Exception("Failed to print. Command \"$redactedCommand\" " . |
|
| 231 | - "failed with exit code $retval: " . trim($errorStr) . trim($outputStr)); |
|
| 230 | + throw new Exception("Failed to print. Command \"$redactedCommand\" ". |
|
| 231 | + "failed with exit code $retval: ".trim($errorStr).trim($outputStr)); |
|
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | 234 | |
@@ -253,10 +253,10 @@ discard block |
||
| 253 | 253 | /* Windows-friendly printing of all sorts */ |
| 254 | 254 | if (!$this -> isLocal) { |
| 255 | 255 | /* Networked printing */ |
| 256 | - $device = "\\\\" . $this -> hostname . "\\" . $this -> printerName; |
|
| 256 | + $device = "\\\\".$this -> hostname."\\".$this -> printerName; |
|
| 257 | 257 | if ($this -> userName !== null) { |
| 258 | 258 | /* Log in */ |
| 259 | - $user = "/user:" . ($this -> workgroup != null ? ($this -> workgroup . "\\") : "") . $this -> userName; |
|
| 259 | + $user = "/user:".($this -> workgroup != null ? ($this -> workgroup."\\") : "").$this -> userName; |
|
| 260 | 260 | if ($this -> userPassword == null) { |
| 261 | 261 | $command = sprintf( |
| 262 | 262 | "net use %s %s", |
@@ -280,8 +280,8 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | $retval = $this -> runCommand($command, $outputStr, $errorStr); |
| 282 | 282 | if ($retval != 0) { |
| 283 | - throw new Exception("Failed to print. Command \"$redactedCommand\" " . |
|
| 284 | - "failed with exit code $retval: " . trim($errorStr)); |
|
| 283 | + throw new Exception("Failed to print. Command \"$redactedCommand\" ". |
|
| 284 | + "failed with exit code $retval: ".trim($errorStr)); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | /* Final print-out */ |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | } else { |
| 298 | 298 | /* Drop data straight on the printer */ |
| 299 | 299 | if (!$this -> runWrite($data, $this -> printerName)) { |
| 300 | - throw new Exception("Failed to write file to printer at " . $this -> printerName); |
|
| 300 | + throw new Exception("Failed to write file to printer at ".$this -> printerName); |
|
| 301 | 301 | } |
| 302 | 302 | } |
| 303 | 303 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | $imgData = str_repeat("\0", $imgHeight * $imgWidth); |
| 28 | 28 | for ($y = 0; $y < $imgHeight; $y++) { |
| 29 | 29 | for ($x = 0; $x < $imgWidth; $x++) { |
| 30 | - $imgData[$y * $imgWidth + $x] = $image -> getPixel($x, $y) == 0 ? 0: 1; |
|
| 30 | + $imgData[$y * $imgWidth + $x] = $image -> getPixel($x, $y) == 0 ? 0 : 1; |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | $this -> setImgWidth($imgWidth); |
@@ -434,11 +434,11 @@ discard block |
||
| 434 | 434 | if (!$this -> profile -> getSupportsBarcodeB()) { |
| 435 | 435 | // A simpler barcode command which supports fewer codes |
| 436 | 436 | self::validateInteger($type, 65, 71, __FUNCTION__); |
| 437 | - $this -> connector -> write(self::GS . "k" . chr($type - 65) . $content . self::NUL); |
|
| 437 | + $this -> connector -> write(self::GS."k".chr($type - 65).$content.self::NUL); |
|
| 438 | 438 | return; |
| 439 | 439 | } |
| 440 | 440 | // More advanced function B, used in preference |
| 441 | - $this -> connector -> write(self::GS . "k" . chr($type) . chr(strlen($content)) . $content); |
|
| 441 | + $this -> connector -> write(self::GS."k".chr($type).chr(strlen($content)).$content); |
|
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | /** |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | self::validateInteger($size, 0, 3, __FUNCTION__); |
| 459 | 459 | $rasterData = $img -> toRasterFormat(); |
| 460 | 460 | $header = Printer::dataHeader([$img -> getWidthBytes(), $img -> getHeight()], true); |
| 461 | - $this -> connector -> write(self::GS . "v0" . chr($size) . $header); |
|
| 461 | + $this -> connector -> write(self::GS."v0".chr($size).$header); |
|
| 462 | 462 | $this -> connector -> write($rasterData); |
| 463 | 463 | } |
| 464 | 464 | |
@@ -475,8 +475,8 @@ discard block |
||
| 475 | 475 | */ |
| 476 | 476 | public function bitImageColumnFormat(EscposImage $img, int $size = Printer::IMG_DEFAULT) |
| 477 | 477 | { |
| 478 | - $highDensityVertical = ! (($size & self::IMG_DOUBLE_HEIGHT) == Printer::IMG_DOUBLE_HEIGHT); |
|
| 479 | - $highDensityHorizontal = ! (($size & self::IMG_DOUBLE_WIDTH) == Printer::IMG_DOUBLE_WIDTH); |
|
| 478 | + $highDensityVertical = !(($size & self::IMG_DOUBLE_HEIGHT) == Printer::IMG_DOUBLE_HEIGHT); |
|
| 479 | + $highDensityHorizontal = !(($size & self::IMG_DOUBLE_WIDTH) == Printer::IMG_DOUBLE_WIDTH); |
|
| 480 | 480 | // Experimental column format printing |
| 481 | 481 | // This feature is not yet complete and may produce unpredictable results. |
| 482 | 482 | $this -> setLineSpacing(16); // 16-dot line spacing. This is the correct value on both TM-T20 and TM-U220 |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | $header = Printer::dataHeader([$img -> getWidth()], true); |
| 487 | 487 | foreach ($colFormatData as $line) { |
| 488 | 488 | // Print each line, double density etc for printing are set here also |
| 489 | - $this -> connector -> write(self::ESC . "*" . chr($densityCode) . $header . $line); |
|
| 489 | + $this -> connector -> write(self::ESC."*".chr($densityCode).$header.$line); |
|
| 490 | 490 | $this -> feed(); |
| 491 | 491 | // sleep(0.1); // Reduces the amount of trouble that a TM-U220 has keeping up with large images |
| 492 | 492 | } |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | public function cut(int $mode = Printer::CUT_FULL, int $lines = 3) |
| 512 | 512 | { |
| 513 | 513 | // TODO validation on cut() inputs |
| 514 | - $this -> connector -> write(self::GS . "V" . chr($mode) . chr($lines)); |
|
| 514 | + $this -> connector -> write(self::GS."V".chr($mode).chr($lines)); |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | /** |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | if ($lines <= 1) { |
| 526 | 526 | $this -> connector -> write(self::LF); |
| 527 | 527 | } else { |
| 528 | - $this -> connector -> write(self::ESC . "d" . chr($lines)); |
|
| 528 | + $this -> connector -> write(self::ESC."d".chr($lines)); |
|
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | */ |
| 544 | 544 | public function release() |
| 545 | 545 | { |
| 546 | - $this -> connector -> write(self::ESC . chr(113)); |
|
| 546 | + $this -> connector -> write(self::ESC.chr(113)); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /** |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | public function feedReverse(int $lines = 1) |
| 555 | 555 | { |
| 556 | 556 | self::validateInteger($lines, 1, 255, __FUNCTION__); |
| 557 | - $this -> connector -> write(self::ESC . "e" . chr($lines)); |
|
| 557 | + $this -> connector -> write(self::ESC."e".chr($lines)); |
|
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | /** |
@@ -617,8 +617,8 @@ discard block |
||
| 617 | 617 | $colors = '1'; |
| 618 | 618 | $xm = (($size & self::IMG_DOUBLE_WIDTH) == Printer::IMG_DOUBLE_WIDTH) ? chr(2) : chr(1); |
| 619 | 619 | $ym = (($size & self::IMG_DOUBLE_HEIGHT) == Printer::IMG_DOUBLE_HEIGHT) ? chr(2) : chr(1); |
| 620 | - $header = $tone . $xm . $ym . $colors . $imgHeader; |
|
| 621 | - $this -> wrapperSendGraphicsData('0', 'p', $header . $rasterData); |
|
| 620 | + $header = $tone.$xm.$ym.$colors.$imgHeader; |
|
| 621 | + $this -> wrapperSendGraphicsData('0', 'p', $header.$rasterData); |
|
| 622 | 622 | $this -> wrapperSendGraphicsData('0', '2'); |
| 623 | 623 | } |
| 624 | 624 | |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | */ |
| 628 | 628 | public function initialize() |
| 629 | 629 | { |
| 630 | - $this -> connector -> write(self::ESC . "@"); |
|
| 630 | + $this -> connector -> write(self::ESC."@"); |
|
| 631 | 631 | $this -> characterTable = 0; |
| 632 | 632 | } |
| 633 | 633 | |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | $this -> wrapperSend2dCodeData(chr(67), $cn, chr($width)); |
| 671 | 671 | $this -> wrapperSend2dCodeData(chr(68), $cn, chr($heightMultiplier)); |
| 672 | 672 | // Set error correction ratio: 1% to 400% |
| 673 | - $ec_int = (int)ceil(floatval($ec) * 10); |
|
| 673 | + $ec_int = (int) ceil(floatval($ec) * 10); |
|
| 674 | 674 | $this -> wrapperSend2dCodeData(chr(69), $cn, chr($ec_int), '1'); |
| 675 | 675 | // Send content & print |
| 676 | 676 | $this -> wrapperSend2dCodeData(chr(80), $cn, $content, '0'); |
@@ -690,7 +690,7 @@ discard block |
||
| 690 | 690 | self::validateInteger($pin, 0, 1, __FUNCTION__); |
| 691 | 691 | self::validateInteger($on_ms, 1, 511, __FUNCTION__); |
| 692 | 692 | self::validateInteger($off_ms, 1, 511, __FUNCTION__); |
| 693 | - $this -> connector -> write(self::ESC . "p" . chr($pin + 48) . chr($on_ms / 2) . chr($off_ms / 2)); |
|
| 693 | + $this -> connector -> write(self::ESC."p".chr($pin + 48).chr($on_ms / 2).chr($off_ms / 2)); |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | /** |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | } |
| 716 | 716 | $cn = '1'; // Code type for QR code |
| 717 | 717 | // Select model: 1, 2 or micro. |
| 718 | - $this -> wrapperSend2dCodeData(chr(65), $cn, chr(48 + $model) . chr(0)); |
|
| 718 | + $this -> wrapperSend2dCodeData(chr(65), $cn, chr(48 + $model).chr(0)); |
|
| 719 | 719 | // Set dot size. |
| 720 | 720 | $this -> wrapperSend2dCodeData(chr(67), $cn, chr($size)); |
| 721 | 721 | // Set error correction level: L, M, Q, or H |
@@ -741,10 +741,10 @@ discard block |
||
| 741 | 741 | $this -> characterTable = $table; |
| 742 | 742 | if ($this -> profile -> getSupportsStarCommands()) { |
| 743 | 743 | /* Not an ESC/POS command: STAR printers stash all the extra code pages under a different command. */ |
| 744 | - $this -> connector -> write(self::ESC . self::GS . "t" . chr($table)); |
|
| 744 | + $this -> connector -> write(self::ESC.self::GS."t".chr($table)); |
|
| 745 | 745 | return; |
| 746 | 746 | } |
| 747 | - $this -> connector -> write(self::ESC . "t" . chr($table)); |
|
| 747 | + $this -> connector -> write(self::ESC."t".chr($table)); |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | /** |
@@ -767,7 +767,7 @@ discard block |
||
| 767 | 767 | throw new InvalidArgumentException("Invalid mode"); |
| 768 | 768 | } |
| 769 | 769 | |
| 770 | - $this -> connector -> write(self::ESC . "!" . chr($mode)); |
|
| 770 | + $this -> connector -> write(self::ESC."!".chr($mode)); |
|
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | /** |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | */ |
| 778 | 778 | public function selectUserDefinedCharacterSet($on = true) |
| 779 | 779 | { |
| 780 | - $this -> connector -> write(self::ESC . "%". ($on ? chr(1) : chr(0))); |
|
| 780 | + $this -> connector -> write(self::ESC."%".($on ? chr(1) : chr(0))); |
|
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | /** |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | public function setBarcodeHeight(int $height = 8) |
| 789 | 789 | { |
| 790 | 790 | self::validateInteger($height, 1, 255, __FUNCTION__); |
| 791 | - $this -> connector -> write(self::GS . "h" . chr($height)); |
|
| 791 | + $this -> connector -> write(self::GS."h".chr($height)); |
|
| 792 | 792 | } |
| 793 | 793 | |
| 794 | 794 | /** |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | public function setBarcodeWidth(int $width = 3) |
| 801 | 801 | { |
| 802 | 802 | self::validateInteger($width, 1, 255, __FUNCTION__); |
| 803 | - $this -> connector -> write(self::GS . "w" . chr($width)); |
|
| 803 | + $this -> connector -> write(self::GS."w".chr($width)); |
|
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | /** |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | public function setBarcodeTextPosition(int $position = Printer::BARCODE_TEXT_NONE) |
| 814 | 814 | { |
| 815 | 815 | self::validateInteger($position, 0, 3, __FUNCTION__, "Barcode text position"); |
| 816 | - $this -> connector -> write(self::GS . "H" . chr($position)); |
|
| 816 | + $this -> connector -> write(self::GS."H".chr($position)); |
|
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | /** |
@@ -824,7 +824,7 @@ discard block |
||
| 824 | 824 | public function setDoubleStrike(bool $on = true) |
| 825 | 825 | { |
| 826 | 826 | self::validateBoolean($on, __FUNCTION__); |
| 827 | - $this -> connector -> write(self::ESC . "G". ($on ? chr(1) : chr(0))); |
|
| 827 | + $this -> connector -> write(self::ESC."G".($on ? chr(1) : chr(0))); |
|
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | /** |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | public function setColor(int $color = Printer::COLOR_1) |
| 836 | 836 | { |
| 837 | 837 | self::validateInteger($color, 0, 1, __FUNCTION__, "Color"); |
| 838 | - $this -> connector -> write(self::ESC . "r" . chr($color)); |
|
| 838 | + $this -> connector -> write(self::ESC."r".chr($color)); |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | /** |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | public function setEmphasis(bool $on = true) |
| 847 | 847 | { |
| 848 | 848 | self::validateBoolean($on, __FUNCTION__); |
| 849 | - $this -> connector -> write(self::ESC . "E". ($on ? chr(1) : chr(0))); |
|
| 849 | + $this -> connector -> write(self::ESC."E".($on ? chr(1) : chr(0))); |
|
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | /** |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | public function setFont(int $font = Printer::FONT_A) |
| 858 | 858 | { |
| 859 | 859 | self::validateInteger($font, 0, 2, __FUNCTION__); |
| 860 | - $this -> connector -> write(self::ESC . "M" . chr($font)); |
|
| 860 | + $this -> connector -> write(self::ESC."M".chr($font)); |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | /** |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | public function setJustification(int $justification = Printer::JUSTIFY_LEFT) |
| 869 | 869 | { |
| 870 | 870 | self::validateInteger($justification, 0, 2, __FUNCTION__); |
| 871 | - $this -> connector -> write(self::ESC . "a" . chr($justification)); |
|
| 871 | + $this -> connector -> write(self::ESC."a".chr($justification)); |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | /** |
@@ -883,11 +883,11 @@ discard block |
||
| 883 | 883 | { |
| 884 | 884 | if ($height === null) { |
| 885 | 885 | // Reset to default |
| 886 | - $this -> connector -> write(self::ESC . "2"); // Revert to default line spacing |
|
| 886 | + $this -> connector -> write(self::ESC."2"); // Revert to default line spacing |
|
| 887 | 887 | return; |
| 888 | 888 | } |
| 889 | 889 | self::validateInteger($height, 1, 255, __FUNCTION__); |
| 890 | - $this -> connector -> write(self::ESC . "3" . chr($height)); |
|
| 890 | + $this -> connector -> write(self::ESC."3".chr($height)); |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | /** |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | public function setPrintLeftMargin(int $margin = 0) |
| 899 | 899 | { |
| 900 | 900 | self::validateInteger($margin, 0, 65535, __FUNCTION__); |
| 901 | - $this -> connector -> write(Printer::GS . 'L' . self::intLowHigh($margin, 2)); |
|
| 901 | + $this -> connector -> write(Printer::GS.'L'.self::intLowHigh($margin, 2)); |
|
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | /** |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | public function setPrintWidth(int $width = 512) |
| 911 | 911 | { |
| 912 | 912 | self::validateInteger($width, 1, 65535, __FUNCTION__); |
| 913 | - $this -> connector -> write(Printer::GS . 'W' . self::intLowHigh($width, 2)); |
|
| 913 | + $this -> connector -> write(Printer::GS.'W'.self::intLowHigh($width, 2)); |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | /** |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | public function setReverseColors(bool $on = true) |
| 943 | 943 | { |
| 944 | 944 | self::validateBoolean($on, __FUNCTION__); |
| 945 | - $this -> connector -> write(self::GS . "B" . ($on ? chr(1) : chr(0))); |
|
| 945 | + $this -> connector -> write(self::GS."B".($on ? chr(1) : chr(0))); |
|
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | /** |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | self::validateInteger($widthMultiplier, 1, 8, __FUNCTION__); |
| 957 | 957 | self::validateInteger($heightMultiplier, 1, 8, __FUNCTION__); |
| 958 | 958 | $c = (2 << 3) * ($widthMultiplier - 1) + ($heightMultiplier - 1); |
| 959 | - $this -> connector -> write(self::GS . "!" . chr($c)); |
|
| 959 | + $this -> connector -> write(self::GS."!".chr($c)); |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | /** |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | { |
| 969 | 969 | /* Set the underline */ |
| 970 | 970 | self::validateInteger($underline, 0, 2, __FUNCTION__); |
| 971 | - $this -> connector -> write(self::ESC . "-" . chr($underline)); |
|
| 971 | + $this -> connector -> write(self::ESC."-".chr($underline)); |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | /** |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | */ |
| 979 | 979 | public function setUpsideDown(bool $on = true) |
| 980 | 980 | { |
| 981 | - $this -> connector -> write(self::ESC . "{" . ($on ? chr(1) : chr(0))); |
|
| 981 | + $this -> connector -> write(self::ESC."{".($on ? chr(1) : chr(0))); |
|
| 982 | 982 | } |
| 983 | 983 | |
| 984 | 984 | /** |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | */ |
| 992 | 992 | public function text(string $str) |
| 993 | 993 | { |
| 994 | - $this -> buffer -> writeText((string)$str); |
|
| 994 | + $this -> buffer -> writeText((string) $str); |
|
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | /** |
@@ -1004,10 +1004,10 @@ discard block |
||
| 1004 | 1004 | */ |
| 1005 | 1005 | public function textChinese(string $str = "") |
| 1006 | 1006 | { |
| 1007 | - $this -> connector -> write(self::FS . "&"); |
|
| 1007 | + $this -> connector -> write(self::FS."&"); |
|
| 1008 | 1008 | $str = \UConverter::transcode($str, "GBK", "UTF-8"); |
| 1009 | - $this -> buffer -> writeTextRaw((string)$str); |
|
| 1010 | - $this -> connector -> write(self::FS . "."); |
|
| 1009 | + $this -> buffer -> writeTextRaw((string) $str); |
|
| 1010 | + $this -> connector -> write(self::FS."."); |
|
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | /** |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | */ |
| 1021 | 1021 | public function textRaw(string $str = "") |
| 1022 | 1022 | { |
| 1023 | - $this -> buffer -> writeTextRaw((string)$str); |
|
| 1023 | + $this -> buffer -> writeTextRaw((string) $str); |
|
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | /** |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | throw new InvalidArgumentException("wrapperSend2dCodeData: cn and fn must be one character each."); |
| 1039 | 1039 | } |
| 1040 | 1040 | $header = $this -> intLowHigh(strlen($data) + strlen($m) + 2, 2); |
| 1041 | - $this -> connector -> write(self::GS . "(k" . $header . $cn . $fn . $m . $data); |
|
| 1041 | + $this -> connector -> write(self::GS."(k".$header.$cn.$fn.$m.$data); |
|
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | 1044 | /** |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | throw new InvalidArgumentException("wrapperSendGraphicsData: m and fn must be one character each."); |
| 1056 | 1056 | } |
| 1057 | 1057 | $header = $this -> intLowHigh(strlen($data) + 2, 2); |
| 1058 | - $this -> connector -> write(self::GS . "(L" . $header . $m . $fn . $data); |
|
| 1058 | + $this -> connector -> write(self::GS."(L".$header.$m.$fn.$data); |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | /** |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | $outp = ""; |
| 1094 | 1094 | for ($i = 0; $i < $length; $i++) { |
| 1095 | 1095 | $outp .= chr($input % 256); |
| 1096 | - $input = (int)($input / 256); |
|
| 1096 | + $input = (int) ($input / 256); |
|
| 1097 | 1097 | } |
| 1098 | 1098 | return $outp; |
| 1099 | 1099 | } |
@@ -1166,7 +1166,7 @@ discard block |
||
| 1166 | 1166 | // Put together a good error "range 1-2 or 4-6" |
| 1167 | 1167 | $rangeStr = "range "; |
| 1168 | 1168 | for ($i = 0; $i < count($ranges); $i++) { |
| 1169 | - $rangeStr .= $ranges[$i][0] . "-" . $ranges[$i][1]; |
|
| 1169 | + $rangeStr .= $ranges[$i][0]."-".$ranges[$i][1]; |
|
| 1170 | 1170 | if ($i == count($ranges) - 1) { |
| 1171 | 1171 | continue; |
| 1172 | 1172 | } elseif ($i == count($ranges) - 2) { |