From af04b82068b8efc84736c5641b8c9e0d1a48a026 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 24 Sep 2023 14:56:44 +0000 Subject: [PATCH] rector fixes --- Admin/Installer.php | 24 +++++++++---------- Controller/ApiBillController.php | 4 +--- Theme/Backend/bill-create.tpl.php | 2 +- .../user-purchase-bill-dashboard.tpl.php | 8 +++---- tests/Bootstrap.php | 4 ++-- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Admin/Installer.php b/Admin/Installer.php index 0a7faea..7ced5b7 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -141,9 +141,9 @@ final class Installer extends InstallerAbstract continue; } - $billAttrType[$attribute['name']] = !\is_array($responseData['response']) - ? $responseData['response']->toArray() - : $responseData['response']; + $billAttrType[$attribute['name']] = \is_array($responseData['response']) + ? $responseData['response'] + : $responseData['response']->toArray(); $isFirst = true; foreach ($attribute['l11n'] as $language => $l11n) { @@ -212,9 +212,9 @@ final class Installer extends InstallerAbstract continue; } - $attrValue = !\is_array($responseData['response']) - ? $responseData['response']->toArray() - : $responseData['response']; + $attrValue = \is_array($responseData['response']) + ? $responseData['response'] + : $responseData['response']->toArray(); $billAttrValue[$attribute['name']][] = $attrValue; @@ -298,9 +298,9 @@ final class Installer extends InstallerAbstract continue; } - $result = !\is_array($responseData['response']) - ? $responseData['response']->toArray() - : $responseData['response']; + $result = \is_array($responseData['response']) + ? $responseData['response'] + : $responseData['response']->toArray(); $results[] = $result; } @@ -350,9 +350,9 @@ final class Installer extends InstallerAbstract continue; } - $billType = !\is_array($responseData['response']) - ? $responseData['response']->toArray() - : $responseData['response']; + $billType = \is_array($responseData['response']) + ? $responseData['response'] + : $responseData['response']->toArray(); $billTypes[] = $billType; diff --git a/Controller/ApiBillController.php b/Controller/ApiBillController.php index 39ddce1..4078921 100755 --- a/Controller/ApiBillController.php +++ b/Controller/ApiBillController.php @@ -321,14 +321,12 @@ final class ApiBillController extends Controller $taxCode = $this->app->moduleManager->get('Billing', 'ApiTax') ->getTaxCodeFromClientItem($client, $item, $request->header->l11n->country); - $element = BillElement::fromItem( + return BillElement::fromItem( $item, $taxCode, $request->getDataInt('quantity') ?? 1, $bill->id ); - - return $element; } /** diff --git a/Theme/Backend/bill-create.tpl.php b/Theme/Backend/bill-create.tpl.php index c575002..d8e30bc 100755 --- a/Theme/Backend/bill-create.tpl.php +++ b/Theme/Backend/bill-create.tpl.php @@ -42,7 +42,7 @@ $archive = $bill->getFileByTypeName('original'); $logs = $this->data['logs'] ?? []; $editable = $bill->id === 0 || \in_array($bill->getStatus(), [BillStatus::DRAFT, BillStatus::UNPARSED]); -$disabled = !$editable ? ' disabled' : ''; +$disabled = $editable ? '' : ' disabled'; echo $this->data['nav']->render(); ?> diff --git a/Theme/Backend/user-purchase-bill-dashboard.tpl.php b/Theme/Backend/user-purchase-bill-dashboard.tpl.php index 2bb596b..c66623b 100755 --- a/Theme/Backend/user-purchase-bill-dashboard.tpl.php +++ b/Theme/Backend/user-purchase-bill-dashboard.tpl.php @@ -171,11 +171,11 @@ echo $this->data['nav']->render(); ?> ?>">billAddress; ?> billZip; ?> billCity; ?> - billCountry) - ? ISO3166NameEnum::getByName( + billCountry) + ? '' + : ISO3166NameEnum::getByName( ISO3166TwoEnum::getName($value->billCountry) - ) - : ''; ?> + ); ?> grossCosts->getAmount(); ?> billDate?->format('Y-m-d'); ?> diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index b904f0c..44438e2 100755 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -381,7 +381,7 @@ function phpServe() : void // Execute the command and store the process ID $output = []; - echo \sprintf('Starting server...') . \PHP_EOL; + echo 'Starting server...' . \PHP_EOL; echo \sprintf(' Current directory: %s', \getcwd()) . \PHP_EOL; echo \sprintf(' %s', $command); \exec($command, $output); @@ -406,7 +406,7 @@ function phpServe() : void // Kill the web server when the process ends \register_shutdown_function(function() use ($killCommand, $pid) : void { - echo \PHP_EOL . \sprintf('Stopping server...') . \PHP_EOL; + echo \PHP_EOL . 'Stopping server...' . \PHP_EOL; echo \sprintf(' %s - Killing process with ID %d', \date('r'), $pid) . \PHP_EOL; \exec($killCommand . $pid); });