mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
PermissionParser: use constants for keys
This commit is contained in:
parent
2a33c9ed3b
commit
43e69041fc
@ -53,6 +53,10 @@ class PermissionParser{
|
||||
"false" => self::DEFAULT_FALSE,
|
||||
];
|
||||
|
||||
private const KEY_DEFAULT = "default";
|
||||
private const KEY_CHILDREN = "children";
|
||||
private const KEY_DESCRIPTION = "description";
|
||||
|
||||
/**
|
||||
* @param bool|string $value
|
||||
*
|
||||
@ -86,16 +90,16 @@ class PermissionParser{
|
||||
$result = [];
|
||||
foreach(Utils::stringifyKeys($data) as $name => $entry){
|
||||
$desc = null;
|
||||
if(isset($entry["default"])){
|
||||
$default = PermissionParser::defaultFromString($entry["default"]);
|
||||
if(isset($entry[self::KEY_DEFAULT])){
|
||||
$default = PermissionParser::defaultFromString($entry[self::KEY_DEFAULT]);
|
||||
}
|
||||
|
||||
if(isset($entry["children"])){
|
||||
if(isset($entry[self::KEY_CHILDREN])){
|
||||
throw new PermissionParserException("Nested permission declarations are no longer supported. Declare each permission separately.");
|
||||
}
|
||||
|
||||
if(isset($entry["description"])){
|
||||
$desc = $entry["description"];
|
||||
if(isset($entry[self::KEY_DESCRIPTION])){
|
||||
$desc = $entry[self::KEY_DESCRIPTION];
|
||||
}
|
||||
|
||||
$result[$default][] = new Permission($name, $desc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user