phpcs, static and unit test fixes

This commit is contained in:
Dennis Eichhorn 2021-10-03 09:16:47 +02:00
parent 408d2fcf1a
commit 298a63dfdf
9 changed files with 72 additions and 11 deletions

View File

@ -32,6 +32,14 @@ use phpOMS\System\File\Local\Directory;
*/ */
final class Installer extends InstallerAbstract final class Installer extends InstallerAbstract
{ {
/**
* Path of the file
*
* @var string
* @since 1.0.0
*/
public const PATH = __DIR__;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -26,4 +26,11 @@ use phpOMS\Module\StatusAbstract;
*/ */
final class Status extends StatusAbstract final class Status extends StatusAbstract
{ {
/**
* Path of the file
*
* @var string
* @since 1.0.0
*/
public const PATH = __DIR__;
} }

View File

@ -24,6 +24,13 @@ use phpOMS\Module\UninstallerAbstract;
* @link https://orange-management.org * @link https://orange-management.org
* @since 1.0.0 * @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__;
} }

View File

@ -118,7 +118,7 @@ final class Importer extends ImporterAbstract
* *
* @param RequestAbstract $request Request * @param RequestAbstract $request Request
* *
* @return bool * @return array
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -142,7 +142,7 @@ final class Importer extends ImporterAbstract
$this->account = $request->header->account; $this->account = $request->header->account;
if ($this->remote->getStatus() !== DatabaseStatus::OK) { if ($this->remote->getStatus() !== DatabaseStatus::OK) {
return false; return [];
} }
if (((bool) ($request->getData('customers') ?? false))) { if (((bool) ($request->getData('customers') ?? false))) {

View File

@ -0,0 +1,13 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Exchange\Interfaces\OMS\Exporter
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);

View File

@ -121,6 +121,11 @@ final class Exporter extends ExporterAbstract
$basePath = __DIR__ . '/../../../'; $basePath = __DIR__ . '/../../../';
$modules = \scandir($basePath); $modules = \scandir($basePath);
if ($modules === false) {
return [];
}
foreach ($modules as $module) { foreach ($modules as $module) {
$themePath = $basePath . $module . '/Theme/'; $themePath = $basePath . $module . '/Theme/';
@ -131,8 +136,12 @@ final class Exporter extends ExporterAbstract
} }
$module = \trim($module, '/'); $module = \trim($module, '/');
$themes = \scandir($themePath); $themes = \scandir($themePath);
if ($themes === false) {
continue; // @codeCoverageIgnore
}
foreach ($themes as $theme) { foreach ($themes as $theme) {
$theme = \trim($theme, '/'); $theme = \trim($theme, '/');
$langPath = $themePath . $theme . '/Lang/'; $langPath = $themePath . $theme . '/Lang/';
@ -144,6 +153,10 @@ final class Exporter extends ExporterAbstract
} }
$languages = \scandir($themePath . $theme . '/Lang/'); $languages = \scandir($themePath . $theme . '/Lang/');
if ($languages === false) {
continue; // @codeCoverageIgnore
}
foreach ($languages as $language) { foreach ($languages as $language) {
if (\stripos($language, '.lang.') === false || $language === '.' || $language === '..') { if (\stripos($language, '.lang.') === false || $language === '.' || $language === '..') {
continue; continue;

View File

@ -0,0 +1,13 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Exchange\Interfaces\OMS\Import
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);

View File

@ -140,7 +140,11 @@ final class Importer extends ImporterAbstract
{ {
$upload = ApiController::uploadFilesToDestination($request->getFiles()); $upload = ApiController::uploadFilesToDestination($request->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, ';', '"'); $header = \fgetcsv($fp, 0, ';', '"');
$languageArray = []; $languageArray = [];

View File

@ -67,9 +67,7 @@ class ExchangeLog implements \JsonSerializable, ArrayableInterface
* @var int * @var int
* @since 1.0.0 * @since 1.0.0
*/ */
public int | public int|InterfaceManager $exchange = 0;
InterfaceManager $exchange = 0;
/** /**
* Date type. * Date type.
@ -85,9 +83,7 @@ InterfaceManager $exchange = 0;
* @var int|Account * @var int|Account
* @since 1.0.0 * @since 1.0.0
*/ */
public int | public int|Account $createdBy = 0;
Account $createdBy = 0;
/** /**
* Constructor. * Constructor.