From 298a63dfdf32cb3b735058ba421e686e913adb61 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 3 Oct 2021 09:16:47 +0200 Subject: [PATCH] phpcs, static and unit test fixes --- Admin/Installer.php | 8 ++++++++ Admin/Status.php | 7 +++++++ Admin/Uninstaller.php | 9 ++++++++- Interfaces/GSD/Importer.php | 4 ++-- Interfaces/OMS/Export/LanguageExport.php | 13 +++++++++++++ Interfaces/OMS/Exporter.php | 15 ++++++++++++++- Interfaces/OMS/Import/LanguageImport.php | 13 +++++++++++++ Interfaces/OMS/Importer.php | 6 +++++- Models/ExchangeLog.php | 8 ++------ 9 files changed, 72 insertions(+), 11 deletions(-) diff --git a/Admin/Installer.php b/Admin/Installer.php index 0c32572..e38710a 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -32,6 +32,14 @@ use phpOMS\System\File\Local\Directory; */ final class Installer extends InstallerAbstract { + /** + * Path of the file + * + * @var string + * @since 1.0.0 + */ + public const PATH = __DIR__; + /** * {@inheritdoc} */ diff --git a/Admin/Status.php b/Admin/Status.php index b5328ba..ea66858 100755 --- a/Admin/Status.php +++ b/Admin/Status.php @@ -26,4 +26,11 @@ use phpOMS\Module\StatusAbstract; */ final class Status extends StatusAbstract { + /** + * Path of the file + * + * @var string + * @since 1.0.0 + */ + public const PATH = __DIR__; } diff --git a/Admin/Uninstaller.php b/Admin/Uninstaller.php index 122677b..74bb313 100755 --- a/Admin/Uninstaller.php +++ b/Admin/Uninstaller.php @@ -24,6 +24,13 @@ use phpOMS\Module\UninstallerAbstract; * @link https://orange-management.org * @since 1.0.0 */ -final class Uninstaller extends UninstallerAbstract +final class Installer extends InstallerAbstract { + /** + * Path of the file + * + * @var string + * @since 1.0.0 + */ + public const PATH = __DIR__; } diff --git a/Interfaces/GSD/Importer.php b/Interfaces/GSD/Importer.php index 429c274..5562a11 100755 --- a/Interfaces/GSD/Importer.php +++ b/Interfaces/GSD/Importer.php @@ -118,7 +118,7 @@ final class Importer extends ImporterAbstract * * @param RequestAbstract $request Request * - * @return bool + * @return array * * @since 1.0.0 */ @@ -142,7 +142,7 @@ final class Importer extends ImporterAbstract $this->account = $request->header->account; if ($this->remote->getStatus() !== DatabaseStatus::OK) { - return false; + return []; } if (((bool) ($request->getData('customers') ?? false))) { diff --git a/Interfaces/OMS/Export/LanguageExport.php b/Interfaces/OMS/Export/LanguageExport.php index e69de29..ae690b6 100755 --- a/Interfaces/OMS/Export/LanguageExport.php +++ b/Interfaces/OMS/Export/LanguageExport.php @@ -0,0 +1,13 @@ +getFiles()); - $fp = \fopen($upload['file0']['path'] . '/' . $upload['file0']['filename'], 'r'); + $fp = \fopen($upload['file0']['path'] . '/' . $upload['file0']['filename'], 'r'); + if ($fp === false) { + return; + } + $header = \fgetcsv($fp, 0, ';', '"'); $languageArray = []; diff --git a/Models/ExchangeLog.php b/Models/ExchangeLog.php index 344eca2..0b21aeb 100755 --- a/Models/ExchangeLog.php +++ b/Models/ExchangeLog.php @@ -67,9 +67,7 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface * @var int * @since 1.0.0 */ - public int | - -InterfaceManager $exchange = 0; + public int|InterfaceManager $exchange = 0; /** * Date type. @@ -85,9 +83,7 @@ InterfaceManager $exchange = 0; * @var int|Account * @since 1.0.0 */ - public int | - -Account $createdBy = 0; + public int|Account $createdBy = 0; /** * Constructor.