function RefinableCalculatedPermissions::addItem

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

Overrides RefinableCalculatedPermissionsInterface::addItem

1 call to RefinableCalculatedPermissions::addItem()
RefinableCalculatedPermissions::merge in core/lib/Drupal/Core/Session/RefinableCalculatedPermissions.php
Merge another calculated permissions object into this one.

File

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

Class

RefinableCalculatedPermissions
Represents a calculated set of permissions with cacheable metadata.

Namespace

Drupal\Core\Session

Code

public function addItem(CalculatedPermissionsItemInterface $item, bool $overwrite = FALSE) : self {
    if (!$overwrite && ($existing = $this->getItem($item->getScope(), $item->getIdentifier()))) {
        $item = static::mergeItems($existing, $item);
    }
    $this->items[$item->getScope()][$item->getIdentifier()] = $item;
    return $this;
}

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