You are here

protected function Permission::validate in Organic groups 8

Validates the given property and value.

Parameters

string $property: The property to validate.

mixed $value: The value to validate.

2 calls to Permission::validate()
GroupContentOperationPermission::validate in src/GroupContentOperationPermission.php
Validates the given property and value.
Permission::set in src/Permission.php
Sets the value for the given property.
1 method overrides Permission::validate()
GroupContentOperationPermission::validate in src/GroupContentOperationPermission.php
Validates the given property and value.

File

src/Permission.php, line 162

Class

Permission
Base class for OG permissions.

Namespace

Drupal\og

Code

protected function validate($property, $value) {
  if (!property_exists($this, $property)) {
    throw new \InvalidArgumentException("Invalid property {$property}.");
  }
  if ($property === 'restrictAccess' && !is_bool($value)) {
    throw new \InvalidArgumentException('The value for the "restrict access" property should be a boolean.');
  }
}