• Модуль: intranet
  • Путь к файлу: ~/bitrix/modules/intranet/lib/binding/map/mapsection.php
  • Класс: BitrixIntranetBindingMapMapSection
  • Вызов: MapSection::merge
public function merge(self $anotherSection): self
{
	if (($anotherSection->getScope() !== $this->getScope()) || ($anotherSection->getCode() !== $this->getCode()))
	{
		throw new ArgumentException(
			'Merge of ' . static::class . ' object is possible only when two objects have the same scope and code'
		);
	}

	$result = new static($this->getScope(), $this->getCode());

	foreach (array_merge($this->getItems(), $anotherSection->getItems()) as $item)
	{
		if (!$result->hasByCode($item->getCode()))
		{
			$newItem = new MapItem($item->getCode(), $item->getCustomRestPlacementCode());

			$result->add($newItem);
		}
	}

	return $result;
}