You are here

public function CalculatedGroupPermissions::__construct in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Access/CalculatedGroupPermissions.php \Drupal\group\Access\CalculatedGroupPermissions::__construct()

Constructs a new CalculatedGroupPermissions.

Parameters

\Drupal\group\Access\CalculatedGroupPermissionsInterface $source: The calculated group permission to create a value object from.

File

src/Access/CalculatedGroupPermissions.php, line 23

Class

CalculatedGroupPermissions
Represents a calculated set of group permissions with cacheable metadata.

Namespace

Drupal\group\Access

Code

public function __construct(CalculatedGroupPermissionsInterface $source) {
  foreach ($source
    ->getItems() as $item) {
    $this->items[$item
      ->getScope()][$item
      ->getIdentifier()] = $item;
  }
  $this
    ->setCacheability($source);
}