You are here

public function DefaultRoleEvent::offsetSet in Organic groups 8

File

src/Event/DefaultRoleEvent.php, line 107

Class

DefaultRoleEvent
Event that is fired when default roles are compiled.

Namespace

Drupal\og\Event

Code

public function offsetSet($key, $role) {
  $this
    ->validate($role);
  if ($role
    ->getName() !== $key) {
    throw new \InvalidArgumentException('The key and the "name" property of the role should be identical.');
  }
  $this
    ->setRole($role);
}