function RefinableCalculatedPermissions::merge

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Session/RefinableCalculatedPermissions.php \Drupal\Core\Session\RefinableCalculatedPermissions::merge()

Merge another calculated permissions object into this one.

This merges (not replaces) all permissions and cacheable metadata.

Parameters

\Drupal\Core\Session\CalculatedPermissionsInterface $other: The other calculated permissions object to merge into this one.

Return value

self

Overrides RefinableCalculatedPermissionsInterface::merge

File

core/lib/Drupal/Core/Session/RefinableCalculatedPermissions.php, line 55

Class

RefinableCalculatedPermissions
Represents a calculated set of permissions with cacheable metadata.

Namespace

Drupal\Core\Session

Code

public function merge(CalculatedPermissionsInterface $calculated_permissions) : self {
  foreach ($calculated_permissions->getItems() as $item) {
    $this->addItem($item);
  }
  $this->addCacheableDependency($calculated_permissions);
  return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.