mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 17:41:46 +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,
|
"false" => self::DEFAULT_FALSE,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
private const KEY_DEFAULT = "default";
|
||||||
|
private const KEY_CHILDREN = "children";
|
||||||
|
private const KEY_DESCRIPTION = "description";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool|string $value
|
* @param bool|string $value
|
||||||
*
|
*
|
||||||
@ -86,16 +90,16 @@ class PermissionParser{
|
|||||||
$result = [];
|
$result = [];
|
||||||
foreach(Utils::stringifyKeys($data) as $name => $entry){
|
foreach(Utils::stringifyKeys($data) as $name => $entry){
|
||||||
$desc = null;
|
$desc = null;
|
||||||
if(isset($entry["default"])){
|
if(isset($entry[self::KEY_DEFAULT])){
|
||||||
$default = PermissionParser::defaultFromString($entry["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.");
|
throw new PermissionParserException("Nested permission declarations are no longer supported. Declare each permission separately.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($entry["description"])){
|
if(isset($entry[self::KEY_DESCRIPTION])){
|
||||||
$desc = $entry["description"];
|
$desc = $entry[self::KEY_DESCRIPTION];
|
||||||
}
|
}
|
||||||
|
|
||||||
$result[$default][] = new Permission($name, $desc);
|
$result[$default][] = new Permission($name, $desc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user