mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 08:56:15 +00:00
Add tools/ to PHPStan analysis
This commit is contained in:
@ -39,11 +39,13 @@ $usageMessage = "Options:\n";
|
||||
foreach($requiredOpts as $_opt => $_desc){
|
||||
$usageMessage .= "\t--$_opt : $_desc\n";
|
||||
}
|
||||
$args = getopt("", array_map(function(string $str){ return "$str:"; }, array_keys($requiredOpts)));
|
||||
$plainArgs = getopt("", array_map(function(string $str){ return "$str:"; }, array_keys($requiredOpts)));
|
||||
$args = [];
|
||||
foreach($requiredOpts as $opt => $desc){
|
||||
if(!isset($args[$opt])){
|
||||
if(!isset($plainArgs[$opt]) || !is_string($plainArgs[$opt])){
|
||||
die($usageMessage);
|
||||
}
|
||||
$args[$opt] = $plainArgs[$opt];
|
||||
}
|
||||
if(!array_key_exists($args["format"], $writableFormats)){
|
||||
die($usageMessage);
|
||||
@ -53,9 +55,9 @@ $inputPath = realpath($args["world"]);
|
||||
if($inputPath === false){
|
||||
die("Cannot find input world at location: " . $args["world"]);
|
||||
}
|
||||
$backupPath = $args["backup"];
|
||||
if((!@mkdir($backupPath, 0777, true) and !is_dir($backupPath)) or !is_writable($backupPath)){
|
||||
die("Backup file path " . $backupPath . " is not writable (permission error or doesn't exist), aborting");
|
||||
$backupPath = realpath($args["backup"]);
|
||||
if($backupPath === false || (!@mkdir($backupPath, 0777, true) and !is_dir($backupPath)) or !is_writable($backupPath)){
|
||||
die("Backup file path " . $args["backup"] . " is not writable (permission error or doesn't exist), aborting");
|
||||
}
|
||||
|
||||
$oldProviderClasses = $providerManager->getMatchingProviders($inputPath);
|
||||
@ -68,5 +70,5 @@ if(count($oldProviderClasses) > 1){
|
||||
$oldProviderClass = array_shift($oldProviderClasses);
|
||||
$oldProvider = $oldProviderClass->fromPath($inputPath);
|
||||
|
||||
$converter = new FormatConverter($oldProvider, $writableFormats[$args["format"]], realpath($backupPath), GlobalLogger::get());
|
||||
$converter = new FormatConverter($oldProvider, $writableFormats[$args["format"]], $backupPath, GlobalLogger::get());
|
||||
$converter->execute();
|
||||
|
Reference in New Issue
Block a user