mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 20:07:09 +00:00
PermissionParser: remove unmaintained code
This commit is contained in:
parent
9867424117
commit
3e9a37ca77
@ -119,44 +119,4 @@ class PermissionParser{
|
||||
|
||||
return new Permission($name, $desc, $default, $children);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Permission[] $permissions
|
||||
*
|
||||
* @return mixed[]
|
||||
* @phpstan-return array<string, array<string, mixed>>
|
||||
*/
|
||||
public static function emitPermissions(array $permissions) : array{
|
||||
$result = [];
|
||||
foreach($permissions as $permission){
|
||||
$result[$permission->getName()] = self::emitPermission($permission);
|
||||
}
|
||||
ksort($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[]
|
||||
* @phpstan-return array<string, mixed>
|
||||
*/
|
||||
private static function emitPermission(Permission $permission) : array{
|
||||
$result = [
|
||||
"description" => $permission->getDescription(),
|
||||
"default" => $permission->getDefault()
|
||||
];
|
||||
$children = [];
|
||||
foreach($permission->getChildren() as $name => $bool){
|
||||
//TODO: really? wtf??? this system is so overengineered it makes my head hurt...
|
||||
$child = PermissionManager::getInstance()->getPermission($name);
|
||||
if($child === null){
|
||||
throw new \UnexpectedValueException("Permission child should be a registered permission");
|
||||
}
|
||||
$children[$name] = self::emitPermission($child);
|
||||
}
|
||||
if(count($children) > 0){
|
||||
ksort($children);
|
||||
$result["children"] = $children;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user