Upgraded to PHP-CS-Fixer v3

This commit is contained in:
Bernd Bestel
2021-07-03 17:46:47 +02:00
parent 766eae5a7a
commit 0f88eed08c
21 changed files with 267 additions and 211 deletions

View File

@@ -10,8 +10,6 @@ use Mike42\Escpos\Printer;
class PrintService extends BaseService
{
/**
* Initialises the printer
* @return Printer Printer handle
@@ -19,15 +17,17 @@ class PrintService extends BaseService
*/
private static function getPrinterHandle()
{
if (GROCY_TPRINTER_IS_NETWORK_PRINTER) {
if (GROCY_TPRINTER_IS_NETWORK_PRINTER)
{
$connector = new NetworkPrintConnector(GROCY_TPRINTER_IP, GROCY_TPRINTER_PORT);
} else {
}
else
{
$connector = new FilePrintConnector(GROCY_TPRINTER_CONNECTOR);
}
return new Printer($connector);
}
/**
* Prints the grocy logo and date
* @param Printer $printer Printer handle
@@ -41,7 +41,7 @@ class PrintService extends BaseService
$printer->selectPrintMode(Printer::MODE_DOUBLE_WIDTH);
$printer->setTextSize(4, 4);
$printer->setReverseColors(true);
$printer->text("grocy");
$printer->text('grocy');
$printer->setJustification();
$printer->setTextSize(1, 1);
$printer->setReverseColors(false);
@@ -61,7 +61,9 @@ class PrintService extends BaseService
{
$printer = self::getPrinterHandle();
if ($printer === false)
throw new Exception("Unable to connect to printer");
{
throw new Exception('Unable to connect to printer');
}
if ($printHeader)
{
@@ -78,7 +80,7 @@ class PrintService extends BaseService
$printer->cut();
$printer->close();
return [
'result' => "OK"
'result' => 'OK'
];
}
}