src/Model/ProjectAccess.php
public function changeEnvironmentRole(Environment $environment, $newRole)
    {
        $access = $environment->getUser($this->id);
        if ($access) {
            if ($access->role === $newRole) {
                throw new \InvalidArgumentException("There is nothing to change");
            }

            return $access->update(['role' => $newRole]);
        }

        return $environment->addUser($this->id, $newRole);
    }
public function changeEnvironmentRole(Environment $environment, $newRole)
    {
        $access = $environment->getUser($this->id);
        if ($access) {
            if ($access->role === $newRole) {
                throw new \InvalidArgumentException("There is nothing to change");
            }

            return $access->update(['role' => $newRole]);
        }

        return $environment->addUser($this->id, $newRole);
    }
public function changeEnvironmentRole ( Environment $ environment , $ newRole ) { $ access = $ environment -> getUser ( $ this -> id ) ; if ( $ access ) { if ( $ access -> role === $ newRole ) { throw new \ InvalidArgumentException ( "There is nothing to change" ) ; } return $ access -> update ( [ 'role' => $ newRole ] ) ; } return $ environment -> addUser ( $ this -> id , $ newRole ) ; }
Change the user's environment-level role.

@param Environment $environment
@param string $newRole The new role (see EnvironmentAccess::$roles).

@return Result
Change the user s environment - level role .