public function addPermission(Permission $permission)
    {
        if (!$permission->permission_id) {
            throw new ValidationError("Permission has invalid state");
        }
        if (!in_array($permission, $this->permissions)) {
            $this->permissions[] = $permission;
            return true;
        }
        return false;
    }
public function addPermission(Permission $permission)
    {
        if (!$permission->permission_id) {
            throw new ValidationError("Permission has invalid state");
        }
        if (!in_array($permission, $this->permissions)) {
            $this->permissions[] = $permission;
            return true;
        }
        return false;
    }
public function addPermission ( Permission $ permission ) { if ( ! $ permission -> permission_id ) { throw new ValidationError ( "Permission has invalid state" ) ; } if ( ! in_array ( $ permission , $ this -> permissions ) ) { $ this -> permissions [ ] = $ permission ; return true ; } return false ; }
Add a permission to the roles current permissions if it does not already exist

@param Permission $permission
@return bool
@throws \RBAC\Exception\ValidationError Permission has no ID set
Add a permission to the roles current permissions if it does not already exist