From 616175eef5f8bd51a19645060f5d075acbd42277 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 4 Nov 2023 20:33:00 +0100 Subject: [PATCH] cosmetic code review and typo --- src/Backend.php | 4 ++-- src/Config.php | 12 +++++----- src/Core.php | 4 ++-- src/Install.php | 4 ++-- src/Manage.php | 4 ++-- src/My.php | 6 ++--- src/Settings.php | 58 ++++++++++++++++++++++++++++++++++++++--------- src/Uninstall.php | 4 ++-- src/Utils.php | 9 +++++--- src/Zip.php | 4 ++-- 10 files changed, 74 insertions(+), 35 deletions(-) diff --git a/src/Backend.php b/src/Backend.php index 526aac2..dbb8027 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -9,8 +9,8 @@ use Dotclear\Core\Process; use Dotclear\Core\Backend\Favorites; /** - * @brief pacKman backend class. - * @ingroup pacKman + * @brief pacKman backend class. + * @ingroup pacKman * * @author Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html diff --git a/src/Config.php b/src/Config.php index 3df717c..26224fb 100644 --- a/src/Config.php +++ b/src/Config.php @@ -21,8 +21,8 @@ use Dotclear\Helper\Html\Form\{ use Exception; /** - * @brief pacKman configuration class. - * @ingroup pacKman + * @brief pacKman configuration class. + * @ingroup pacKman * * @author Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html @@ -111,7 +111,7 @@ class Config extends Process // pack_repository (new Para())->items([ (new Label($check_repo . __('Path to repository:')))->for('pack_repository'), - (new Input('pack_repository'))->class('maximal')->size(65)->maxlenght(255)->value($s->pack_repository), + (new Input('pack_repository'))->class('maximal')->size(65)->maxlength(255)->value($s->pack_repository), ]), (new Note())->class('form-note')->text( sprintf( @@ -131,13 +131,13 @@ class Config extends Process // pack_filename (new Para())->items([ (new Label($check_first . __('Name of exported package:')))->for('pack_filename'), - (new Input('pack_filename'))->class('maximal')->size(65)->maxlenght(255)->value($s->pack_filename), + (new Input('pack_filename'))->class('maximal')->size(65)->maxlength(255)->value($s->pack_filename), ]), (new Note())->text(sprintf(__('Preconization: %s'), '%type%-%id%'))->class('form-note'), // secondpack_filename (new Para())->items([ (new Label($check_second . __('Name of second exported package:')))->for('secondpack_filename'), - (new Input('secondpack_filename'))->class('maximal')->size(65)->maxlenght(255)->value($s->secondpack_filename), + (new Input('secondpack_filename'))->class('maximal')->size(65)->maxlength(255)->value($s->secondpack_filename), ]), (new Note())->text(sprintf(__('Preconization: %s'), '%type%-%id%-%version%'))->class('form-note'), // pack_overwrite @@ -150,7 +150,7 @@ class Config extends Process // pack_excludefiles (new Para())->items([ (new Label(__('Extra files to exclude from package:')))->for('pack_excludefiles'), - (new Input('pack_excludefiles'))->class('maximal')->size(65)->maxlenght(255)->value($s->pack_excludefiles), + (new Input('pack_excludefiles'))->class('maximal')->size(65)->maxlength(255)->value($s->pack_excludefiles), ]), (new Note())->text(sprintf(__('Preconization: %s'), '*.zip,*.tar,*.tar.gz'))->class('form-note'), // pack_nocomment diff --git a/src/Core.php b/src/Core.php index ed3320e..aeeeab6 100644 --- a/src/Core.php +++ b/src/Core.php @@ -12,8 +12,8 @@ use Dotclear\Module\ModuleDefine; use Exception; /** - * @brief pacKman main class. - * @ingroup pacKman + * @brief pacKman main class. + * @ingroup pacKman * * @author Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html diff --git a/src/Install.php b/src/Install.php index 1aa18bc..5eb4ea1 100644 --- a/src/Install.php +++ b/src/Install.php @@ -9,8 +9,8 @@ use Dotclear\Core\Process; use Exception; /** - * @brief pacKman install class. - * @ingroup pacKman + * @brief pacKman install class. + * @ingroup pacKman * * @author Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html diff --git a/src/Manage.php b/src/Manage.php index fcf2a13..7637ecc 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -19,8 +19,8 @@ use Dotclear\Helper\Network\Http; use Exception; /** - * @brief pacKman manage page class. - * @ingroup pacKman + * @brief pacKman manage page class. + * @ingroup pacKman * * @author Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html diff --git a/src/My.php b/src/My.php index 39ba9f3..e11769b 100644 --- a/src/My.php +++ b/src/My.php @@ -8,8 +8,8 @@ use Dotclear\App; use Dotclear\Module\MyPlugin; /** - * @brief pacKman My plugin helper. - * @ingroup pacKman + * @brief pacKman My plugin helper. + * @ingroup pacKman * * @author Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html @@ -36,8 +36,8 @@ class My extends MyPlugin public static function checkCustomContext(int $context): ?bool { - // Limit to super admin return match ($context) { + // Limit to super admin self::MODULE => App::auth()->isSuperAdmin(), default => null, }; diff --git a/src/Settings.php b/src/Settings.php index 46cfe96..dcfbb53 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -5,39 +5,75 @@ declare(strict_types=1); namespace Dotclear\Plugin\pacKman; /** - * @brief pacKman settings class. - * @ingroup pacKman + * @brief pacKman settings class. + * @ingroup pacKman * * @author Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html */ class Settings { - // Remove comments from files + /** + * Remove comments from files. + * + * @var bool $pack_nocomment + */ public readonly bool $pack_nocomment; - // Remove comments from files + /** + * Remove comments from files. + * + * @var bool $pack_fixnewline + */ public readonly bool $pack_fixnewline; - // Overwrite existing package + /** + * Overwrite existing package. + * + * @var bool $pack_overwrite + */ public readonly bool $pack_overwrite; - // Name of package + /** + * Name of package. + * + * @var string $pack_filename + */ public readonly string $pack_filename; - // Name of second package + /** + * Name of second package. + * + * @var string $secondpack_filename + */ public readonly string $secondpack_filename; - // Path to package repository + /** + * Path to package repository. + * + * @var string $pack_repository + */ public readonly string $pack_repository; - // Seperate themes and plugins repository + /** + * Seperate themes and plugins repository. + * + * @var bool $pack_typedrepo + */ public readonly bool $pack_typedrepo; - // Extra files to exclude from package + /** + * Extra files to exclude from package. + * + * @var string $pack_excludefiles + */ public readonly string $pack_excludefiles; - // Hide distributed modules from lists + /** + * Hide distributed modules from lists. + * + * @var bool $hide_distrib + */ public readonly bool $hide_distrib; /** diff --git a/src/Uninstall.php b/src/Uninstall.php index 29f2aa8..cf15780 100644 --- a/src/Uninstall.php +++ b/src/Uninstall.php @@ -8,8 +8,8 @@ use Dotclear\Core\Process; use Dotclear\Plugin\Uninstaller\Uninstaller; /** - * @brief pacKman Uninstaller class. - * @ingroup pacKman + * @brief pacKman Uninstaller class. + * @ingroup pacKman * * @author Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html diff --git a/src/Utils.php b/src/Utils.php index a83abdd..751349c 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -25,8 +25,8 @@ use Dotclear\Module\ModuleDefine; use Exception; /** - * @brief pacKman utils class. - * @ingroup pacKman + * @brief pacKman utils class. + * @ingroup pacKman * * @author Jean-Christian Denis * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html @@ -98,7 +98,7 @@ class Utils /** * Get modules list form. * - * @param array $modules The modules + * @param array $modules The modules * @param string $type The modules type * @param string $title The list title * @@ -116,6 +116,9 @@ class Utils $tbody = []; self::sort($modules); foreach ($modules as $module) { + if (!is_a($module, ModuleDefine::class)) { + continue; + } $tbody[] = (new Para(null, 'tr')) ->class('line') ->items([ diff --git a/src/Zip.php b/src/Zip.php index b2bb4f2..eda6f11 100644 --- a/src/Zip.php +++ b/src/Zip.php @@ -5,8 +5,8 @@ declare(strict_types=1); namespace Dotclear\Plugin\pacKman; /** - * @brief pacKman zip class. - * @ingroup pacKman + * @brief pacKman zip class. + * @ingroup pacKman * * This class extends dotclear zip class * to tweak writeFile method.