refactor module command to phpstan-level-1

This commit is contained in:
crazywhalecc
2022-04-02 19:15:03 +08:00
committed by Jerry Ma
parent 182a4e7b06
commit d490892092
5 changed files with 74 additions and 83 deletions

View File

@@ -141,19 +141,20 @@ class ModuleManager
/**
* 打包模块
* @param $module
* @param array $module 模块信息
* @param string $target 目标路径
* @throws ZMException
*/
public static function packModule($module): bool
public static function packModule(array $module, string $target): bool
{
try {
$packer = new ModulePacker($module);
if (!is_dir(DataProvider::getDataFolder())) {
throw new ModulePackException(zm_internal_errcode('E00070') . 'zm_data dir not found!');
}
$path = realpath(DataProvider::getDataFolder() . '/output');
$path = realpath($target);
if ($path === false) {
mkdir($path = DataProvider::getDataFolder() . '/output');
mkdir($path = $target, 0755, true);
}
$packer->setOutputPath($path);
$packer->setOverride();