65 return $value ? self::DEFAULT_TRUE : self::DEFAULT_FALSE;
67 $lower = strtolower($value);
68 if(isset(self::DEFAULT_STRING_MAP[$lower])){
69 return self::DEFAULT_STRING_MAP[$lower];
72 throw new PermissionParserException(
"Unknown permission default name \"$value\"");
83 public static function loadPermissions(array $data,
string $default = self::DEFAULT_FALSE) : array{
85 foreach(Utils::stringifyKeys($data) as $name => $entry){
87 if(isset($entry[self::KEY_DEFAULT])){
91 if(isset($entry[self::KEY_CHILDREN])){
92 throw new PermissionParserException(
"Nested permission declarations are no longer supported. Declare each permission separately.");
95 if(isset($entry[self::KEY_DESCRIPTION])){
96 $desc = $entry[self::KEY_DESCRIPTION];
99 $result[$default][] =
new Permission($name, $desc);