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

@@ -71,5 +71,4 @@ class BaseService
{
return PrintService::getInstance();
}
}

View File

@@ -5,15 +5,23 @@ namespace Grocy\Services;
class ChoresService extends BaseService
{
const CHORE_ASSIGNMENT_TYPE_IN_ALPHABETICAL_ORDER = 'in-alphabetical-order';
const CHORE_ASSIGNMENT_TYPE_NO_ASSIGNMENT = 'no-assignment';
const CHORE_ASSIGNMENT_TYPE_RANDOM = 'random';
const CHORE_ASSIGNMENT_TYPE_WHO_LEAST_DID_FIRST = 'who-least-did-first';
const CHORE_PERIOD_TYPE_DAILY = 'daily';
const CHORE_PERIOD_TYPE_DYNAMIC_REGULAR = 'dynamic-regular';
const CHORE_PERIOD_TYPE_MANUALLY = 'manually';
const CHORE_PERIOD_TYPE_MONTHLY = 'monthly';
const CHORE_PERIOD_TYPE_WEEKLY = 'weekly';
const CHORE_PERIOD_TYPE_YEARLY = 'yearly';
public function CalculateNextExecutionAssignment($choreId)

View File

@@ -5,7 +5,9 @@ namespace Grocy\Services;
class DatabaseService
{
private static $DbConnection = null;
private static $DbConnectionRaw = null;
private static $instance = null;
/**

View File

@@ -58,12 +58,12 @@ class FilesService extends BaseService
$fileNameWithoutExtension = pathinfo($filePath, PATHINFO_FILENAME);
$fileExtension = pathinfo($filePath, PATHINFO_EXTENSION);
if (getimagesize($filePath) !== false) // Then the file is an image
{
if (getimagesize($filePath) !== false)
{ // Then the file is an image
// Also delete all corresponding "__downscaledto" files when deleting an image
$groupFolderPath = $this->StoragePath . '/' . $group;
$files = scandir($groupFolderPath);
foreach($files as $file)
foreach ($files as $file)
{
if (string_starts_with($file, $fileNameWithoutExtension . '__downscaledto'))
{

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'
];
}
}

View File

@@ -8,13 +8,21 @@ use Grocy\Helpers\WebhookRunner;
class StockService extends BaseService
{
const TRANSACTION_TYPE_CONSUME = 'consume';
const TRANSACTION_TYPE_INVENTORY_CORRECTION = 'inventory-correction';
const TRANSACTION_TYPE_PRODUCT_OPENED = 'product-opened';
const TRANSACTION_TYPE_PURCHASE = 'purchase';
const TRANSACTION_TYPE_SELF_PRODUCTION = 'self-production';
const TRANSACTION_TYPE_STOCK_EDIT_NEW = 'stock-edit-new';
const TRANSACTION_TYPE_STOCK_EDIT_OLD = 'stock-edit-old';
const TRANSACTION_TYPE_TRANSFER_FROM = 'transfer_from';
const TRANSACTION_TYPE_TRANSFER_TO = 'transfer_to';
public function AddMissingProductsToShoppingList($listId = 1)

View File

@@ -5,17 +5,29 @@ namespace Grocy\Services;
class UserfieldsService extends BaseService
{
const USERFIELD_TYPE_CHECKBOX = 'checkbox';
const USERFIELD_TYPE_DATE = 'date';
const USERFIELD_TYPE_DATETIME = 'datetime';
const USERFIELD_TYPE_DECIMAL_NUMBER = 'number-decimal';
const USERFIELD_TYPE_FILE = 'file';
const USERFIELD_TYPE_IMAGE = 'image';
const USERFIELD_TYPE_INTEGRAL_NUMBER = 'number-integral';
const USERFIELD_TYPE_LINK = 'link';
const USERFIELD_TYPE_LINK_WITH_TITLE = 'link-with-title';
const USERFIELD_TYPE_PRESET_CHECKLIST = 'preset-checklist';
const USERFIELD_TYPE_PRESET_LIST = 'preset-list';
const USERFIELD_TYPE_SINGLE_LINE_TEXT = 'text-single-line';
const USERFIELD_TYPE_SINGLE_MULTILINE_TEXT = 'text-multi-line';
protected $OpenApiSpec = null;