code review

This commit is contained in:
Jean-Christian Denis 2022-12-21 15:51:43 +01:00
parent bdd295d5ce
commit 11796eb948
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
11 changed files with 28 additions and 30 deletions

View file

@ -5,7 +5,7 @@
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html

View file

@ -5,7 +5,7 @@
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html

View file

@ -5,7 +5,7 @@
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html

View file

@ -5,7 +5,7 @@
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html

View file

@ -5,7 +5,7 @@
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html

View file

@ -55,6 +55,7 @@ class Install
try {
self::update_0_8_0();
self::putSettings();
return true;
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());

View file

@ -36,16 +36,16 @@ use Exception;
*/
class Manage
{
/** @var improve $improve improve core instance */
/** @var Core $improve improve core instance */
private static $improve = null;
/** @var string $type Current module(s) type */
private static $type = 'plugin';
/** @var string $module Current module id */
private static $module = '-';
/** @var action|null $action Current action module */
/** @var Action|null $action Current action module */
private static $action = null;
private static $init = false;
private static $init = false;
public static function init(): bool
{
@ -56,7 +56,7 @@ class Manage
self::$type = self::getType();
self::$module = self::getModule();
self::$action = self::getAction();
self::$init = true;
self::$init = true;
}
return self::$init;
@ -77,7 +77,7 @@ class Manage
return $module;
}
private static function getAction(): ?action
private static function getAction(): ?Action
{
return empty($_REQUEST['config']) ? null : self::$improve->module($_REQUEST['config']);
}

View file

@ -21,7 +21,7 @@ use Clearbricks;
*
* Manage autoload and some action module helpers.
*/
class prepend
class Prepend
{
private static $init = false;

View file

@ -36,7 +36,7 @@ class Core
'php', 'xml', 'js', 'css', 'csv', 'html', 'htm', 'txt', 'md', 'po',
];
/** @var array<action> $actions Loaded actions modules */
/** @var array<Action> $actions Loaded actions modules */
private $actions = [];
/** @var array<string> $disabled Disabled actions modules */
@ -60,7 +60,7 @@ class Core
dcCore::app()->callBehavior('improveAddAction', $list);
foreach ($list as $action) {
if ($action instanceof action && !isset($this->actions[$action->id()])) {
if ($action instanceof Action && !isset($this->actions[$action->id()])) {
if (in_array($action->id(), $disabled)) {
$this->disabled[$action->id()] = $action->name();
} else {
@ -154,9 +154,9 @@ class Core
*
* @param string $id Module id
*
* @return action action instance
* @return Action action instance
*/
public function module(string $id): ?action
public function module(string $id): ?Action
{
if (empty($id)) {
return null;
@ -168,7 +168,7 @@ class Core
/**
* Get all loaded action modules
*
* @return action[] action instance
* @return Action[] action instance
*/
public function modules(): array
{
@ -338,12 +338,12 @@ class Core
/**
* Sort modules by priority then name
*
* @param action $a ImproveAction instance
* @param action $b ImproveAction instance
* @param Action $a ImproveAction instance
* @param Action $b ImproveAction instance
*
* @return integer Is higher
*/
private function sortModules(action $a, action $b): int
private function sortModules(Action $a, Action $b): int
{
if ($a->priority() == $b->priority()) {
return strcasecmp($a->name(), $b->name());

View file

@ -29,16 +29,13 @@ class po2php extends Action
{
/** @var string License bloc */
private $license = <<<EOF
/**
* @package Dotclear
*
* @copyright Olivier Meunier & Association Dotclear
* @copyright GPL-2.0-only
*/
EOF;
/** @var string Settings dcstore zip url pattern */
private $pattern = '';
/**
* @package Dotclear
*
* @copyright Olivier Meunier & Association Dotclear
* @copyright GPL-2.0-only
*/
EOF;
protected function init(): bool
{

View file

@ -5,7 +5,7 @@
* @package Dotclear
* @subpackage Plugin
*
* @author Jean-Christian Denis
* @author Jean-Christian Denis and contributors
*
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html