From 8e246c7dd3660f020d7a48b1882193463e9e2add Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Mon, 8 May 2023 10:31:45 +0200 Subject: [PATCH] harmonize My class --- src/My.php | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/My.php b/src/My.php index f9dc54b..2c46d90 100644 --- a/src/My.php +++ b/src/My.php @@ -17,14 +17,15 @@ namespace Dotclear\Plugin\emailOptionnel; use dcCore; /** - * Module definitions shortcut. + * This module definitions. */ class My extends \initEmailOptionnel { + /** @var string This module required php version */ + public const PHP_MIN = '7.4'; + /** * This module id. - * - * @return string The module ID */ public static function id(): string { @@ -33,11 +34,27 @@ class My extends \initEmailOptionnel /** * This module name. - * - * @return string The module translated 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()); + } + + /** + * 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, '>='); } }