private function getMappedPermissions(array $permissions): array
    {
        $mappedPermissions = [];
        foreach ($permissions as $permission => $options) {
            $mappedPermissions[strtolower($permission)] = $permission;
            if (is_array($options) && array_key_exists('nested', $options)) {
                $mappedPermissions = array_merge($mappedPermissions, $this->getMappedPermissions($options['nested']));
            }
        }

        return $mappedPermissions;
    }
private function getMappedPermissions(array $permissions): array
    {
        $mappedPermissions = [];
        foreach ($permissions as $permission => $options) {
            $mappedPermissions[strtolower($permission)] = $permission;
            if (is_array($options) && array_key_exists('nested', $options)) {
                $mappedPermissions = array_merge($mappedPermissions, $this->getMappedPermissions($options['nested']));
            }
        }

        return $mappedPermissions;
    }
private function getMappedPermissions ( array $ permissions ) : array { $ mappedPermissions = [ ] ; foreach ( $ permissions as $ permission => $ options ) { $ mappedPermissions [ strtolower ( $ permission ) ] = $ permission ; if ( is_array ( $ options ) && array_key_exists ( 'nested' , $ options ) ) { $ mappedPermissions = array_merge ( $ mappedPermissions , $ this -> getMappedPermissions ( $ options [ 'nested' ] ) ) ; } } return $ mappedPermissions ; }
Recursive function to get mapped permissions.

@param array $permissions

@return array
Recursive function to get mapped permissions .