From 3b0d21372221a7dac93291f51392f4905f7a90f5 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Mon, 8 May 2023 10:37:35 +0200 Subject: [PATCH] harmonize My class --- src/My.php | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/src/My.php b/src/My.php index b38b3c5..643bfd6 100644 --- a/src/My.php +++ b/src/My.php @@ -16,16 +16,22 @@ namespace Dotclear\Plugin\httpPassword; use dcCore; +/** + * This module definitions. + */ class My { - /** @var string This plugin permissions */ + /** @var string This plugin permissions */ public const PERMISSION = 'httpPassword'; - /** @var string Passwords file name */ + /** @var string Passwords file name */ public const FILE_PASSWORD = '.htpasswd'; + /** @var string This module required php version */ + public const PHP_MIN = '7.4'; + /** - * This module id + * This module id. */ public static function id(): string { @@ -33,15 +39,35 @@ class My } /** - * This module name + * This module name. */ public static function name(): string { - return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name')); + $name = dcCore::app()->plugins->moduleInfo(self::id(), 'name'); + + return __(is_string($name) ? $name : self::id()); } /** - * Encryption methods combo + * This module path. + */ + public static function path(): string + { + return dirname(__DIR__); + } + + /** + * Check this module PHP version compliant. + */ + public static function phpCompliant(): bool + { + return version_compare(phpversion(), self::PHP_MIN, '>='); + } + + /** + * Encryption methods combo. + * + * @return array */ public static function cryptCombo(): array { @@ -57,7 +83,9 @@ class My } /** - * Admin section menu + * Admin section menu. + * + * @return array */ public static function sectionCombo(): array {