From 8216ff988b3c3e6da1f2ecb034cb3e7bd8d3914c Mon Sep 17 00:00:00 2001 From: Formatter Bot Date: Sat, 7 Jan 2023 18:02:29 +0000 Subject: [PATCH] Automated formatting changes --- Admin/Install/Media/bill.pdf.php | 18 ++++++++++-------- Admin/Installer.php | 6 ++---- Controller/ApiController.php | 10 +++++----- Models/BillType.php | 8 ++++---- Models/BillTypeMapper.php | 2 +- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Admin/Install/Media/bill.pdf.php b/Admin/Install/Media/bill.pdf.php index 6e13f55..35e7107 100755 --- a/Admin/Install/Media/bill.pdf.php +++ b/Admin/Install/Media/bill.pdf.php @@ -5,11 +5,13 @@ declare(strict_types=1); class MYPDF extends TCPDF { public string $fontName = ''; + public int $fontSize = 8; + public int $sideMargin = 15; //Page header - public function Header() { + public function Header() : void { if ($this->header_xobjid === false) { $this->header_xobjid = $this->startTemplate($this->w, 0); @@ -32,7 +34,7 @@ class MYPDF extends TCPDF $x = 0; $dx = 0; - if (!$this->header_xobj_autoreset AND $this->booklet AND (($this->page % 2) == 0)) { + if (!$this->header_xobj_autoreset && $this->booklet && (($this->page % 2) == 0)) { // adjust margins for booklet mode $dx = ($this->original_lMargin - $this->original_rMargin); } @@ -51,7 +53,7 @@ class MYPDF extends TCPDF } // Page footer - public function Footer() { + public function Footer() : void { $this->SetY(-25); $this->SetFont('helvetica', 'I', 7); @@ -121,7 +123,7 @@ $lineHeight = ($lineHeight - $pdf->getY()) / 3; // Document head $pdf->SetFont('helvetica', 'B', 20); -$title = 'INVOICE'; +$title = 'INVOICE'; $titleWidth = $pdf->GetStringWidth($title, 'helvetica', 'B', 20); $pdf->SetXY( @@ -158,7 +160,7 @@ $pdf->Ln(); $pdf->SetY($pdf->GetY() + 5); $header = ['Item', 'Quantity', 'Rate', 'Total']; -$data = [ +$data = [ ['ASDF', 2.0, 199.90, 399.80], ["123-456-789
This is a item name
This is the item description in more detail for the customer so he knows what this content actually contains.", 2.0, 199.90, 399.80], ["123-456-789
This is a item name
This is the item description in more detail for the customer.", 2.0, "199.90\n-10 %", "150.399.80\n-15.039"], @@ -178,8 +180,8 @@ $data = [ ]; // Header -$w = array($pdf->getPageWidth() - 20 - 20 - 20 - 2*15, 20, 20, 20); -$num_headers = count($header); +$w = [$pdf->getPageWidth() - 20 - 20 - 20 - 2 * 15, 20, 20, 20]; +$num_headers = \count($header); $pdf->setCellPadding(1, 1, 1, 1); @@ -300,4 +302,4 @@ $pdf->writeHTMLCell( $pdf->Ln(); //Close and output PDF document -$pdf->Output('example_048.pdf', 'I'); \ No newline at end of file +$pdf->Output('example_048.pdf', 'I'); diff --git a/Admin/Installer.php b/Admin/Installer.php index d065997..3c1f0b3 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -15,14 +15,12 @@ declare(strict_types=1); namespace Modules\Billing\Admin; use Modules\Billing\Models\BillTransferType; -use Modules\Media\Models\NullCollection; use phpOMS\Application\ApplicationAbstract; use phpOMS\Config\SettingsInterface; -use phpOMS\Localization\ISO639x1Enum; -use phpOMS\Module\InstallerAbstract; -use phpOMS\Module\ModuleInfo; use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpResponse; +use phpOMS\Module\InstallerAbstract; +use phpOMS\Module\ModuleInfo; use phpOMS\Uri\HttpUri; /** diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 0726099..8f22609 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -24,9 +24,8 @@ use Modules\Billing\Models\BillMapper; use Modules\Billing\Models\BillStatus; use Modules\Billing\Models\BillTransferType; use Modules\Billing\Models\BillType; -use phpOMS\Localization\BaseStringL11n; -use Modules\Billing\Models\BillTypeMapper; use Modules\Billing\Models\BillTypeL11nMapper; +use Modules\Billing\Models\BillTypeMapper; use Modules\Billing\Models\SettingsEnum; use Modules\ClientManagement\Models\ClientMapper; use Modules\ItemManagement\Models\ItemMapper; @@ -38,6 +37,7 @@ use Modules\Media\Models\UploadStatus; use Modules\SupplierManagement\Models\NullSupplier; use Modules\SupplierManagement\Models\SupplierMapper; use phpOMS\Autoloader; +use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\Money; use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpResponse; @@ -781,10 +781,10 @@ final class ApiController extends Controller { $billType = new BillType($request->getData('name') ?? ''); $billType->setL11n((string) ($request->getData('title') ?? ''), $request->getData('language') ?? ISO639x1Enum::_EN); - $billType->template = new NullCollection((int) ($request->getData('template') ?? 0)); - $billType->numberFormat = (string) ($request->getData('number_format') ?? '{id}'); + $billType->template = new NullCollection((int) ($request->getData('template') ?? 0)); + $billType->numberFormat = (string) ($request->getData('number_format') ?? '{id}'); $billType->transferStock = (bool) ($request->getData('transfer_stock') ?? false); - $billType->transferType = (int) ($request->getData('transfer_type') ?? BillTransferType::SALES); + $billType->transferType = (int) ($request->getData('transfer_type') ?? BillTransferType::SALES); return $billType; } diff --git a/Models/BillType.php b/Models/BillType.php index e457373..12daebf 100755 --- a/Models/BillType.php +++ b/Models/BillType.php @@ -16,8 +16,8 @@ namespace Modules\Billing\Models; use Modules\Media\Models\Collection; use Modules\Media\Models\NullCollection; -use phpOMS\Localization\ISO639x1Enum; use phpOMS\Localization\BaseStringL11n; +use phpOMS\Localization\ISO639x1Enum; /** * Bill type enum. @@ -83,7 +83,7 @@ class BillType implements \JsonSerializable * Set l11n * * @param string|BaseStringL11n $l11n Tag article l11n - * @param string $lang Language + * @param string $lang Language * * @return void * @@ -96,9 +96,9 @@ class BillType implements \JsonSerializable } elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) { $this->l11n->content = $l11n; } else { - $this->l11n = new BaseStringL11n(); + $this->l11n = new BaseStringL11n(); $this->l11n->content = $l11n; - $this->l11n->ref = $this->id; + $this->l11n->ref = $this->id; $this->l11n->setLanguage($lang); } } diff --git a/Models/BillTypeMapper.php b/Models/BillTypeMapper.php index 6c7c9db..3aa8d0c 100755 --- a/Models/BillTypeMapper.php +++ b/Models/BillTypeMapper.php @@ -35,7 +35,7 @@ final class BillTypeMapper extends DataMapperFactory */ public const COLUMNS = [ 'billing_type_id' => ['name' => 'billing_type_id', 'type' => 'int', 'internal' => 'id'], - 'billing_type_name' => ['name' => 'billing_type_name', 'type' => 'string', 'internal' => 'name'], + 'billing_type_name' => ['name' => 'billing_type_name', 'type' => 'string', 'internal' => 'name'], 'billing_type_number_format' => ['name' => 'billing_type_number_format', 'type' => 'string', 'internal' => 'numberFormat'], 'billing_type_template' => ['name' => 'billing_type_template', 'type' => 'int', 'internal' => 'template'], 'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'],