You are here

public function PermissionEvent::offsetSet in Organic groups 8

File

src/Event/PermissionEvent.php, line 222

Class

PermissionEvent
Event that is fired when OG permissions are compiled.

Namespace

Drupal\og\Event

Code

public function offsetSet($key, $value) {
  if (!$value instanceof PermissionInterface) {
    throw new \InvalidArgumentException('The value must be an object of type PermissionInterface.');
  }
  if ($value
    ->getName() !== $key) {
    throw new \InvalidArgumentException('The key and the permission name must be identical.');
  }
  $this
    ->setpermission($value);
}