Code Duplication    Length = 10-12 lines in 2 locations

source/Spiral/Security/PermissionManager.php 2 locations

@@ 69-80 (lines=12) @@
66
     *
67
     * @return $this
68
     */
69
    public function addRole(string $role): PermissionManager
70
    {
71
        if ($this->hasRole($role)) {
72
            throw new RoleException("Role '{$role}' already exists");
73
        }
74
75
        $this->permissions[$role] = [
76
            //No associated permissions
77
        ];
78
79
        return $this;
80
    }
81
82
    /**
83
     * {@inheritdoc}
@@ 87-96 (lines=10) @@
84
     *
85
     * @return $this
86
     */
87
    public function removeRole(string $role): PermissionManager
88
    {
89
        if (!$this->hasRole($role)) {
90
            throw new RoleException("Undefined role '{$role}'");
91
        }
92
93
        unset($this->permissions[$role]);
94
95
        return $this;
96
    }
97
98
    /**
99
     * {@inheritdoc}