• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/attribute/fieldattributemanager.php
  • Класс: Bitrix\Crm\Attribute\FieldAttributeManager
  • Вызов: FieldAttributeManager::findNeighborPhases
static function findNeighborPhases(int $phaseID, array $phases = []): array
{
	$found = false;
	$prevPhaseId = null;
	$curPhaseId = null;
	$nextPhaseId = null;
	$phaseIds = array_keys($phases);
	$phaseCount = count($phases);
	$steps = $phaseCount + 1;
	for ($i = 0; $i <= $steps; $i++)
	{
		$prevPhaseId = $curPhaseId;
		$curPhaseId = $nextPhaseId;
		$nextPhaseId = ($i < $phaseCount) ? $phaseIds[$i] : null;
		if ($curPhaseId === $phaseID)
		{
			$found = true;
			break;
		}
	}
	if (!$found)
	{
		$prevPhaseId = null;
		$nextPhaseId = null;
	}

	return [
		$prevPhaseId,
		$nextPhaseId,
	];
}