From 3e9a37ca77fa5396960ef313774e4345b15f4243 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 28 Nov 2020 20:51:09 +0000 Subject: [PATCH] PermissionParser: remove unmaintained code --- src/permission/PermissionParser.php | 40 ----------------------------- 1 file changed, 40 deletions(-) diff --git a/src/permission/PermissionParser.php b/src/permission/PermissionParser.php index 17cee102d..80e2c2631 100644 --- a/src/permission/PermissionParser.php +++ b/src/permission/PermissionParser.php @@ -119,44 +119,4 @@ class PermissionParser{ return new Permission($name, $desc, $default, $children); } - - /** - * @param Permission[] $permissions - * - * @return mixed[] - * @phpstan-return array> - */ - 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 - */ - 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; - } }