• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/text.php
  • Класс: BitrixImText
  • Вызов: Text::resolveIntersect
static function resolveIntersect(array $segments): array
{
	usort($segments, fn(array $segmentA, array $segmentB) => $segmentA['START'] <=> $segmentB['START']);

	$result = [];
	$maxEnd = -1;

	foreach ($segments as $segment)
	{
		if ($segment['START'] > $maxEnd)
		{
			$result[] = $segment;
			$maxEnd = $segment['END'];
		}
	}

	return array_reverse($result);
}