• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Entity/Department/Departments.php
  • Класс: BitrixImV2EntityDepartmentDepartments
  • Вызов: Departments::getDeepest
public function getDeepest(): self
{
	$maxDepth = 0;

	foreach ($this as $department)
	{
		$maxDepth = max($maxDepth, $department->getDepth());
	}

	$newCollection = new static();

	foreach ($this as $department)
	{
		if ($department->getDepth() === $maxDepth)
		{
			$newCollection[] = $department;
		}
	}

	return $newCollection;
}